#include <bits/stdc++.h>
using namespace std;
int n, x, y, maxpos = 0;
int b[1000005] = {0};
int c[1000005] = {0};
int main() {
  ios_base::sync_with_stdio(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    b[x] = y;
    maxpos = max(maxpos, x);
  }
  int ans = 0;
  for (int i = 0; i <= maxpos; i++) {
    if (b[i] == 0) {
      if (i == 0)
        c[i] = 0;
      else
        c[i] = c[i - 1];
      continue;
    }
    if (i - b[i] - 1 >= 0)
      c[i] = c[i - b[i] - 1] + 1;
    else
      c[i] = 1;
    ans = max(ans, c[i]);
  }
  cout << n - ans << endl;
  return 0;
}
