n = int(input()) a = list(map(int, input().split())) count = 0 i = 0 while i < n: if i + 1 < n and abs(a[i] - a[i+1]) <= 1: count += 1 i += 2 else: i += 1 print(count)