#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 500;
const long long mod = 1e9 + 7;
const long long INF = 1000000000;
int dx[4] = {0, 0, 1, -1};
int dy[4] = {1, -1, 0, 0};
bool compare(const pair<long long, long long>& i,
             const pair<long long, long long>& j) {
  return i.second < j.second;
}
long long fact[N];
vector<bool> is_prime(100000, true);
vector<int> prime;
void pre() {
  fact[0] = 1;
  for (long long i = 1; i < N; i++) {
    fact[i] = i * fact[i - 1];
    fact[i] %= mod;
  }
}
long long modexp(long long x, long long n) {
  long long r = 1;
  while (n) {
    if (n & 1) r = (r * x) % mod;
    x = (x * x) % mod;
    n >>= 1;
  }
  return r % mod;
}
long long modinv(long long x) { return modexp(x, mod - 2); }
long long ncr(long long n, long long r) {
  if (n < r) return 0;
  long long ans =
      (fact[n] % mod * modinv(fact[r]) % mod * modinv(fact[n - r]) % mod) % mod;
  return ans;
}
long long n, A[N], B[N], vis[N], dp[N];
void solve() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> A[i] >> B[i];
    vis[A[i]] = B[i];
  }
  for (int i = 0; i < N; i++) {
    if (vis[i]) {
      if (i - vis[i] - 1 >= 0)
        dp[i] = dp[i - vis[i] - 1] + 1;
      else
        dp[i] = 1;
    } else
      dp[i] = dp[i - 1];
  }
  long long x = 0;
  for (int i = 0; i < N; i++) x = max(x, dp[i]);
  long long ans = n - x;
  cout << ans << "\n";
  return;
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t = 1;
  for (int i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
