from collections import deque
n = int(input())
a = [int(input()) for i in range(n)]
a.sort()
stack = deque([a.pop()])
while a:
    x = a.pop()
    if x + 1 < stack[-1]:
        stack.pop()
    stack.appendleft(x)

print(len(stack))