#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  vector<long> ip(1000001, -1);
  vector<pair<long long, long long> > p;
  int i, j;
  for (i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    p.push_back(make_pair(a, b));
    ip[a] = i;
  }
  sort(p.begin(), p.end());
  for (i = 0; i < n; i++) ip[p[i].first] = i;
  vector<long long> dp(n, 0);
  long long min = n - 1;
  long long cost = n - 1;
  for (i = 1; i < n; i++) {
    long cd = p[i].first - p[i].second;
    if (p[0].first >= cd) {
      dp[i] = i;
    } else {
      while (cd > 0 && ip[--cd] == -1)
        ;
      long indexNotDestroyed = ip[cd];
      long c = i - indexNotDestroyed - 1;
      dp[i] = c + dp[indexNotDestroyed];
    }
    cost--;
    if (min > dp[i] + cost) min = dp[i] + cost;
  }
  cout << min << endl;
  int xx;
  cin >> xx;
  return 0;
}
