from heapq import heapify, heappop, heappush N = int(input()) A = [] for i in range(N): temp = int(input()) A.append(temp) A.sort() X = [] heappush(X,A[0]) for i in range(1,N): nxt = A[i] if nxt <= X[0] + 1: heappush(X,nxt) else: heappop(X) heappush(X,nxt) ans = len(X) print(ans)