P = 1000 count = 0 for _ in range(P): n, k = map(int, input().split()) if (n-1)%(k+1)!=0: count += 1 print(count)