n=int(input())
lst=input().split()
lst1=[]
s=1
for i in range(1,n):
if int(lst[i])-int(lst[i-1])==1: s+=1 else: lst1.append(s) s=1
print(max(lst1))