n=int(input()) a=list(map(int,input().split())) l=0 c=2 for i in range(1,n): if a[l+1]-a[l]!=a[i]-a[i-1]: c=max(c,i-l+1) l=i print(max(c,i-l+1))