import bisect as bs n = int(input()) a = sorted([int(input()) for _ in range(n)]) used = [False for _ in range(n)] ans = 0 for i in range(n): if used[i]: continue used[i] = True ans += 1 cur = i while cur < n: j = bs.bisect_left(a, a[cur] + 2) if j < n and not used[j]: used[j] = True cur = j print(ans)