#include <fstream>
using namespace std;
ifstream f1("fseq.inp");
ofstream f2("fseq.out");
long n,a[100000],dem = 2,ra = 0;
int main()
{
    f1 >> n;
    for (long i = 0; i < n; i++) f1 >> a[i];
    for (long i = 2; i < n; i++)
    {
        if (a[i-2] + a[i-1] == a[i]) dem++;
        else dem = 2;
        if (dem > ra) ra = dem;
    }
    if (ra <= 2) f2 << "-1";
    else f2 << ra;
    return 0;
}
