#include <bits/stdc++.h>
using namespace std;
struct bc {
  long a, b;
};
bool tmp(bc a, bc b) { return a.a < b.a; }
bc a[200000];
long n, f[200000], m, d[1000100] = {0};
int main() {
  cin >> n;
  for (long i = 0; i < n; i++) {
    scanf("%ld%ld", &a[i].a, &a[i].b);
    d[a[i].a] = 1;
  }
  sort(a, a + n, tmp);
  for (long i = 1000000; i >= 0; i--) d[i] += d[i + 1];
  for (long i = 0; i < n; i++)
    if (a[i].a - a[i].b <= 0)
      a[i].b = d[0] - d[a[i].a + 1];
    else
      a[i].b = d[a[i].a - a[i].b] - d[a[i].a + 1];
  f[0] = 1;
  m = 1;
  for (long i = 1; i < n; i++) {
    f[i] = f[i - a[i].b] + 1;
    m = max(m, f[i]);
  }
  cout << n - m;
}
