#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(1000 * 1000 + 1, 0), b(1000 * 1000 + 3, 0);
  int x = 1000 * 1000, y = 0;
  for (int i = 0; i < n; i++) {
    int t, q;
    cin >> t >> q;
    a[t] = q;
    if (t < x) x = t;
    if (t > y) y = t;
  }
  int ans = 0;
  for (int i = x; i <= y + 1; i++) {
    if (a[i] != 0) {
      b[i + 1] = 1 + b[max(i - a[i], 0)];
    } else {
      b[i + 1] = b[i];
    }
    if (b[i + 1] > ans) ans = b[i + 1];
  }
  cout << n - ans;
  return 0;
}
