n=int(input()) l=[int(input()) for _ in range(n)] s=[0] for x in sorted(l): for i in range(len(s)): if x>s[i]+1: s[i]=x; break if x not in s: s+=[x] s=sorted(s) print(len(s))