N=range(int(input())) A=list(map(int,input().split())) print(max(j-i+1for i in N for j in N if len(set(A[j]-A[j-1]for j in range(i,j)))<2))