#include using namespace std; #define ll long long #define rep(i,a,b) for(int i=(a); i<(b); ++i) void solve() { ll n; cin >> n; vector x(n), h(n); rep(i, 0, n){ cin >> x[i] >> h[i]; } if(n == 1){ cout << 1 << "\n"; return; } ll ans = 2; // first tree always falls left, last tree always falls right ll last_occupied = x[0]; // rightmost occupied point after processing tree 0 (fell left) rep(i, 1, n - 1){ if(x[i] - h[i] > last_occupied){ // Fall left: segment [x[i]-h[i], x[i]] doesn't overlap with last occupied ans++; last_occupied = x[i]; // rightmost point of this tree is x[i] itself } else if(x[i] + h[i] < x[i+1]){ // Fall right: segment [x[i], x[i]+h[i]] doesn't reach next tree ans++; last_occupied = x[i] + h[i]; // rightmost occupied extends to x[i]+h[i] } else { // Can't fell this tree, it stays standing last_occupied = x[i]; } } cout << ans << "\n"; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); solve(); return 0; }