n = int(input()) a = [int(input()) for _ in range(n)] j = -1 b = 0 for i in range(n): if b < a[i]: b = a[i] j = i ans = 1 for i in range(n): if j == i: continue if a[i] + 1 >= a[j]: ans += 1 print(ans)