#include <bits/stdc++.h>
using namespace std;
int const MAXN = 1e6 + 99;
int main() {
  int n;
  cin >> n;
  vector<int> btn(MAXN, -1);
  vector<int> cnt(MAXN, 0);
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    b = min(b, a);
    ++a;
    btn[a] = a - b - 1;
  }
  int ans = 0;
  for (int i = 1; i < MAXN; i++) {
    if (btn[i] == -1) {
      cnt[i] = cnt[i - 1];
    } else {
      cnt[i] = cnt[btn[i]] + 1;
    }
    ans = max(ans, cnt[i]);
  }
  cout << n - ans;
  return 0;
}
