ulvis.paste.net

Paste Search Dynamic
Recent pastes
range
  1. n = int(input())
  2. k = int(input())
  3. a = list(map(int, input().split()))
  4. p = 0
  5. d = 0
  6. a.sort()
  7. for i in range(k):
  8.         if a[i] < n:
  9.                 continue
  10.         elif a[i] == d:
  11.                 continue
  12.         elif a[i] - d >= 3:
  13.                 d = a[i]
  14.                 p += 1
  15.         elif a[i] == n:
  16.                 d = a[i]
  17.                 p += 1
  18. print(p)
Parsed in 0.002 seconds