from heapq import heappush, heapreplace n=int(input()) A=[] for i in range(n): a=int(input()) A.append(a) A.sort() q=[A[0]] for a in A[1:]: if a<=q[0] + 1: heappush(q,a) else: heapreplace(q,a) print(len(q))