R=range I=input N=int(I()) A=list(map(int,I().split())) print(max(min(j for j in R(i+1,N+1)if j==N or A[j-1]+A[i+1]!=A[i]+A[j])-i for i in R(N)))