#include #include #include #include #include #include #include #include using namespace std; int n = 1000; int main(){ int count = 0; for(int i = 0; i < n; i += 1){ long long N, k; cin >> N >> k; if(N%(k+1) == 1) count ++; } cout << count << endl; return 0; }