"""
P1420 最长连号(python3实现)
https://www.luogu.com.cn/problem/P1420
"""
maxn=0
n=int(input())
a=list(map(int,input().split()))
lena=len(a)
for i in range(n):
s=0
for j in range(i+1,n):
if a[j]==a[j-1]+1:
s+=1
else:
break
maxn=max(maxn,s)
print(maxn+1)