import java.util.*;
import java.lang.*;
import java.io.*;

// The main method must be in a class named "Main".
class Main {
    public static void main(String[] args) {
      Scanner sc=new Scanner(System.in);
      int n=sc.nextInt();
      int[] arr=new int[n];
      for(int i=0;i<n;i++)
      {
         arr[i]=sc.nextInt();        
      }
      int count=0;
      for(int i=0;i<n-2;i++)
      {
        int first=arr[i];
        int second=arr[i+1];
        int third=arr[i+2];
        if(first+third==second) count++;
        
      }
     System.out.print(count);
    }
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: