N = int(input()) A = [int(input()) for _ in range(N)] A.sort(reverse=True) count = 0 gara = A[0] q = [] for i in range(1,N): q.sort() if q != [] and A[i] + 1 < q[-1]: a = q.pop() q.append(A[i]) elif A[i] + 1 >= gara: q.append(A[i]) count += 1 else: q.append(A[i]) gara = A[i] print(count+len(q))