#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    int ai, bi;
    cin >> ai >> bi;
    v.push_back(make_pair(ai, bi));
  }
  sort(v.begin(), v.end());
  map<int, int> dp, mp;
  int mindp = n - 1;
  for (int i = 0; i < n; i++) {
    int ai = v[i].first;
    int bi = v[i].second;
    map<int, int>::iterator iter = mp.upper_bound(-ai + bi);
    if (iter == mp.end()) {
      dp[-ai] = max(0, i - 1);
    } else {
      int aj = -iter->first;
      int index = iter->second;
      dp[-ai] = i - index - 1 + dp[-aj];
    }
    mp[-ai] = i;
    mindp = min(mindp, n - i - 1 + dp[-ai]);
  }
  cout << mindp;
}
const int MAXN = 1000002;
int b[MAXN];
int dp[MAXN];
int mp[MAXN];
void solve2() {
  int n;
  cin >> n;
  vector<pair<int, int> > v;
  for (int i = 0; i < n; i++) {
    int ai, bi;
    cin >> ai >> bi;
    b[ai + 1] = bi;
  }
  int mindp = n;
  for (int i = 1, index = 0; i < MAXN; i++) {
    if (!b[i]) {
      mp[i] = index;
      dp[i] = dp[i - 1];
      continue;
    }
    index++;
    mp[i] = index;
    int j = max(0, i - b[i] - 1);
    dp[i] = index - mp[j] - 1 + dp[j];
    mindp = min(mindp, n - index + dp[i]);
  }
  cout << mindp;
}
int main() {
  int t = 1;
  while (t--) {
    solve2();
  }
}
