#include <bits/stdc++.h>
using namespace std;
int cnt[1000001], delfromhere[1000001], lpos[1000001];
vector<pair<int, int> > nig;
int pos[110000], pwr[110000];
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> pos[i] >> pwr[i];
    nig.push_back({pos[i], pwr[i]});
    cnt[pos[i]]++;
    lpos[pos[i]]++;
  }
  sort(nig.begin(), nig.end());
  int x = 0;
  for (int i = 0; i <= 1e6; i++) {
    if (lpos[i]) {
      lpos[i] = x;
      x = i;
    } else
      lpos[i] = x;
  }
  for (int i = 1e6 - 1; i >= 0; i--) cnt[i] += cnt[i + 1];
  int ans, pre, ppos, cur, d;
  for (int i = 1; i <= n; i++) {
    ppos = nig[i - 1].first - nig[i - 1].second;
    if (ppos < 0) ppos = 0;
    delfromhere[nig[i - 1].first] =
        cnt[ppos] - cnt[nig[i - 1].first] + delfromhere[lpos[ppos]];
  }
  ans = 1e9;
  for (int i = 1; i <= n; i++) {
    ans = min(ans, delfromhere[nig[i - 1].first] + n - i);
  }
  cout << ans << "\n";
  return 0;
}
