#include <bits/stdc++.h>
using namespace std;
long long MOD = 1e9 + 7;
long long poww(long long x, long long n) {
  if (n == 1) return x;
  if (n == 0) return 1;
  long long ans = poww(x, n / 2);
  if (n % 2 == 0) return ((ans % MOD) * (ans % MOD)) % MOD;
  return ((ans % MOD) * (x) * (ans % MOD)) % MOD;
}
long long mod(string s1, int a) {
  long long result = 0;
  for (int i = 0; i < s1.size(); i++) {
    result = (result * 10 + (s1[i] - '0')) % a;
  }
  return result;
}
long long square(int x) { return x * (long long)x; }
long long min(long long a, long long b) {
  if (a < b) return a;
  return b;
}
int minimum = INT_MAX;
int ans[1000100];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<pair<int, int> > b(n);
  for (int i = 0; i < n; i++) cin >> b[i].first >> b[i].second;
  sort(b.begin(), b.end());
  int maximum = -1;
  int index = 0;
  ans[0] = 0;
  for (int i = 0; i < 1000100; i++) {
    if (i == 0 && b[index].first == 0) {
      ans[0] = 1;
      maximum = max(maximum, ans[i]);
      index++;
      continue;
    }
    if (i < b[index].first)
      ans[i] = ans[i - 1];
    else if (i == b[index].first) {
      if (i - b[index].second < 0)
        ans[i] = 1;
      else
        ans[i] = ans[i - b[index].second - 1] + 1;
      index++;
    }
    maximum = max(maximum, ans[i]);
  }
  cout << n - maximum;
}
