n=int(input()) x=list(map(int,input().split())) a=0 b=0 p=x[0] for i in x: if i-p==1: a=a+1 if a>=b: a=a else: a=b elif i-p!=1: a=a p=i print(a)