| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 789928 | shoryu386 | Advertisement 2 (JOI23_ho_t2) | C++17 | 0 ms | 0 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
inline int readint() {
  int x = 0;
  char ch = getchar_unlocked();
  while (ch < '0' || ch > '9')
    ch = getchar_unlocked();
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar_unlocked();
  }
  return x;
}
int main() {
  int n;
  cin >> n;
  pair<int, int> origin[n];
  int pmax[n], smax[n];
  for (int x = 0; x < n; x++) {
    origin[x].first = readint(); origin[x].second = readint();
  }
  int carry = -INT_MAX;
  for (int x = 0; x < n; x++) {
    pmax[x] = carry;
    carry = max(carry, origin[x].first + origin[x].second);
  }
  carry = -INT_MAX;
  for (int x = n - 1; x > -1; x--) {
    smax[x] = carry;
    carry = max(carry, origin[x].second - origin[x].first);
  }
  int ans = 0;
  for (int x = 0; x < n; x++) {
    if (origin[x].first + origin[x].second > pmax[x] &&
        origin[x].second - origin[x].first > smax[x]) {
      ans++;
    }
  }
  cout << ans;
}
