#include <bits/stdc++.h>
using namespace std;
int dx[4] = {-1, 1, 0, 0};
int dy[4] = {0, 0, -1, 1};
bool isone(long long, int);
int count(long long);
long long exp(long long, long long, long long);
long long GCD(long long, long long);
vector<pair<int, int> > a;
int b[2000010];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int n1, n2;
    scanf("%d%d", &n1, &n2);
    a.push_back(make_pair(n1, n2));
  }
  sort(a.begin(), a.end());
  int ans = 100010;
  for (int i = 0, j = 0; (i < 2000010) && (j < 100010); i++) {
    if (a[j].first == i) {
      b[i] = 1 + (((i - a[j].second) >= 1) ? b[i - a[j].second - 1] : 0);
      j++;
    } else
      b[i] = b[i - 1];
    ans = min(ans, (j - b[i]) + (n - j));
  }
  printf("%d\n", ans);
  return 0;
}
long long GCD(long long a, long long b) {
  if (!b)
    return a;
  else
    return GCD(b, a % b);
}
long long exp(long long a, long long b, long long c) {
  long long ret = 1LL;
  long long mult = a;
  while (b) {
    if (b & 1) ret = (ret * mult) % c;
    mult = (mult * mult) % c;
    b >>= 1;
  }
  return ret;
}
int count(long long x) {
  int ret = 0;
  while (x) {
    if (x & 1) ret++;
    x >>= 1LL;
  }
  return ret;
}
bool isone(long long x, int pos) { return x & (1 << pos); }
