from collections import Counter n=int(input()) c=Counter([int(input()) for _ in range(n)]) ans=0 for k, v in c.items(): ans=max(ans,v+c[k+1]) print(ans)