n,*a=map(int,open(0).read().split()) x,d=2,2 for a,b,c in zip(a,a[1:],a[2:]): if a-b==b-c:d+=1;x=max(x,d) else:d=2 print(min(n,x))