ans = 0 for x in range(1000): a,b = map(int, raw_input().split()) a -= 1 if (a % (b + 1) == 0): pass else: ans += 1 print ans