#include <bits/stdc++.h>
using namespace std;
long long power(long x, long n) {
  if (n == 0) return 1;
  if (n == 1) return x;
  long n2 = n / 2;
  long long po = power(x, n2);
  if (n % 2) return po * po * x;
  return po * po;
}
long long gcd(long long a, long long b) {
  if (b == 0) return a;
  a %= b;
  return gcd(b, a);
}
int DP[1000006];
class CChainReaction {
 public:
  void solve(std::istream &cin, std::ostream &cout) {
    int n, i, j = 0;
    cin >> n;
    vector<pair<int, int> > V(n);
    for (i = 0; i < n; i++) cin >> V[i].first >> V[i].second;
    sort(V.begin(), V.end());
    DP[0] = 0;
    int mx = 0;
    for (i = 0; i < 1000006; i++) {
      if (V[j].first == i) {
        if (V[j].second >= i)
          DP[i] = 1;
        else
          DP[i] = DP[i - V[j].second - 1] + 1;
        j++;
      } else {
        if (i > 0) DP[i] = DP[i - 1];
      }
    }
    for (i = 0; i < n; i++) mx = max(mx, DP[V[i].first]);
    cout << n - mx << '\n';
  }
};
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  CChainReaction solver;
  std::istream &in(std::cin);
  std::ostream &out(std::cout);
  solver.solve(in, out);
  return 0;
}
