n, k = map(int, input().split())
a=[]
amax =0
acount =0
for i in range(n):
  a.append(int(input()))
  if i > 0:
    if abs(a[i]-a[i-1]) <= 3:
      acount+=1
    else:
      continue
      
print(acount+1)