N = int(input()) A = [int(input()) for _ in range(N)] A.sort() kasane = 0 for i in range(N - 1): if A[i] + 1 < A[i + 1]: kasane += 1 print(N - kasane)