/DASO - Dãy số Fibonacci (OLPCĐ 2013)

<Problem>

http://ntucoder.net/Problem/Details/72
              Uses Crt;
        Var     n,d,i,max:longint;
                a:array[1..1000000] of longint;
        Begin
                readln(n); d:=0;
                max:=-maxlongint;
                for i:=1 to n do read(a[i]);
                for i:=3 to n do
                if (a[i-1]+a[i-2]=a[i]) then
                begin
                        if d=0 then d:=3 else inc(d);
                        if d>max then max:=d;
                end else d:=0;
                if max>0 then writeln(max) else writeln(-1);
                readln;
        End.