n=int(input()) a=list(map(int,input().split())) r=c=min(n,2) for x,y,z in zip(a,a[1:],a[2:]): c=c+1 if y-x==z-y else 2;r=max(r,c) print(r)