n,k = map(int, input().split())

list = []
list2 = []
for i in range(n):
    a = int(input())
    list.append(a)
count = 0
for j in range(len(list)-1):
    if abs(list[j] - list[j+1]) <= 3:
        pass
    else: count += 1
    

print(n-count)