#include <bits/stdc++.h>
using namespace std;
long long int gcd(long long int a, long long int b) {
  return (b ? gcd(b, a % b) : a);
}
long long int power(long long int x, unsigned long long int y) {
  long long int res = 1;
  while (y > 0) {
    if (y & 1) res = res * x;
    y = y >> 1;
    x = x * x;
  }
  return res;
}
unsigned long long int factorial(unsigned long long int x) {
  if (x <= 1) return x;
  return x * factorial(x - 1);
}
long long int nCr(unsigned long long int n, unsigned long long int r) {
  long long int p = 1, k = 1;
  if (n - r < r) r = n - r;
  if (r != 0) {
    while (r) {
      p *= n;
      k *= r;
      long long int m = gcd(p, k);
      p /= m;
      k /= m;
      n--;
      r--;
    }
  } else
    p = 1;
  return p;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int t, i, j, n, k;
  cin >> n;
  vector<long long int> v(n);
  for (i = 0; i < n; i++) cin >> v[i];
  if (n <= 2)
    cout << n << "\n";
  else {
    vector<long long int> dp(n, 1);
    for (i = 1; i < n; i++) {
      if (v[i] == (v[i - 1] + v[i - 2])) {
        dp[i] = max(dp[i] + 2, dp[i - 1] + 1);
      } else if (v[i] == 2 && v[i - 1] == 1) {
        dp[i] = dp[i - 1] + 1;
      } else if ((v[i] == 1 && v[i - 1] == 1) || (v[i] == 1 && v[i - 1] == 0)) {
        dp[i] = 2;
      }
    }
    cout << *max_element(dp.begin(), dp.end()) << "\n";
  }
  return 0;
}
