#include <bits/stdc++.h>
using namespace std;
int compare(const void* a, const void* b) { return (*(int*)a - *(int*)b); }
int main() {
  int n, (*ab)[2], *t, *v, i, act_pos, x, resp = 1;
  cin >> n;
  v = new int[n];
  ab = new int[n][2];
  t = new int[1000000 + 1];
  for (i = 0; i <= 1000000; i++) {
    t[i] = -1;
  }
  for (i = 0; i < n; i++) {
    cin >> ab[i][0] >> ab[i][1];
  }
  qsort(ab, n, sizeof(int[2]), compare);
  for (i = 0; i < n; i++) {
    t[ab[i][0]] = i;
    v[i] = 1;
  }
  act_pos = -1;
  for (i = 0; i <= 1000000; i++) {
    if (t[i] != -1) {
      act_pos = t[i];
    } else {
      t[i] = act_pos;
    }
  }
  for (i = n - 1; i >= 0; i--) {
    resp = (resp > v[i] ? resp : v[i]);
    x = ab[i][0] - ab[i][1];
    if (x >= 0 && t[x] != -1) {
      if (x == ab[t[x]][0]) {
        x--;
      }
      if (x >= 0 && t[x] != -1 && v[t[x]] < v[i] + 1) {
        v[t[x]] = v[i] + 1;
      }
    }
  }
  cout << n - resp << endl;
  return 0;
}
