#include <iostream>

using namespace std;

int main(){
    int n, sc = 0, sp = 0, x = 0;

    cin >> n;

    int c[n], m[n];

    for(int i = 0; i < n; i++){
        cin >> m[i] >> c[i];
    }

    for(int j = 0; j < n; j++){
        sc = 0;
        for (int k = 0; k < j; k++){
            sc += c[j];
        }
        if(sc > m[j]){
            x++;
        }
    }

    cout << n - x << endl;


    return 0;
}
