# No.249 N言っちゃダメゲーム (2) wins = 0 for i in range(1000): n, k = [int(i) for i in input().split()] if n[i] % (k[i] + 1) != 1: wins += 1 print(wins)