#include <bits/stdc++.h>
using namespace std;
const double kEps = 10e-8;
const int kMax = 1000001;
const int kInf = 1 << 30;
int B[kMax];
int F[kMax];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    B[a] = b;
  }
  F[0] = (B[0] == 0) ? 0 : 1;
  for (int i = 1; i < kMax; i++) {
    if (B[i] == 0) {
      F[i] = F[i - 1];
    } else {
      int p = i - (B[i] + 1);
      F[i] = 1;
      if (p >= 0) {
        F[i] += F[p];
      }
    }
  }
  int ans = 0;
  for (int i = kMax - 1; i >= 0; i--) {
    ans = max(ans, F[i]);
  }
  cout << n - ans << endl;
  return EXIT_SUCCESS;
}
