#include <bits/stdc++.h>
using namespace std;
const int maxn = 100000 + 100;
pair<int, int> khar[maxn];
bool mk[10 * maxn];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    mk[a] = true;
    khar[i] = pair<int, int>(a, b);
  }
  sort(khar, khar + n);
  int k = khar[n - 1].first;
  int x[k + 1];
  fill(x, x + k + 1, 0);
  if (mk[0]) x[0] = 1;
  for (int i = 1; i <= k; i++) {
    if (mk[i])
      x[i] += x[i - 1] + 1;
    else
      x[i] += x[i - 1];
  }
  int h[n];
  fill(h, h + n, 0);
  for (int i = 1; i < n; i++) {
    if (khar[i].first - khar[i].second <= 0) {
      h[i] = i;
      continue;
    }
    h[i] = x[khar[i].first - 1] - x[khar[i].first - khar[i].second - 1];
  }
  int g[n];
  fill(g, g + n, 0);
  for (int i = 1; i < n; i++) {
    if (khar[i].first - khar[i].second <= 0) {
      g[i] = i;
      continue;
    }
    if (h[i] == 0)
      g[i] = g[i - 1];
    else
      g[i] = h[i] + g[i - h[i] - 1];
  }
  for (int i = 0; i < n; i++) g[i] += n - i - 1;
  sort(g, g + n);
  cout << g[0] << endl;
  return 0;
}
