#include <iostream>
#include <algorithm>

using namespace std;

int main(){
    int n;
	cin>>n;
    int T[n],D[n];
	for(int i = 0; i < n; i++){
		cin>>T[i]>>D[i];
	}
	int count;
	for(int i = 0; i < n; i++){
		if(D[i] <= T[i]){
			D[i+1]-=T[i]-D[i];
			count++;
		}
		else{
			D[i+1]+=T[i];
		}
		T[i+1]-=T[i];
	}
	cout<<count;
}
