#include <bits/stdc++.h>
using namespace std;
inline long long int f(long long int idx) { return 0; }
inline long long int g(long long int val, long long int key,
                       long long int ret) {
  return (val <= key) ? ret : ret - 1;
}
inline long long int lowbound(long long int l, long long int r,
                              long long int key) {
  long long int mid, val;
  while (l < r) {
    mid = (l + r) >> 1;
    val = f(mid);
    if (key > val) {
      l = mid + 1;
    } else {
      r = mid;
    }
  }
  return g(f(l), key, l);
}
bitset<1000001> ok;
inline void seive() {
  ok.set();
  for (int i = 2; i * i < 1000001; i++)
    if (ok[i])
      for (int j = i << 1; j < 1000001; j += i) ok.reset(j);
}
long long int phi[1000001];
inline void totient() {
  for (int i = int(1); i < int(1000001); i++) phi[i] = (i & 1) ? i : i / 2;
  for (long long int i = 3; i < 1000001; i += 2)
    if (phi[i] == i)
      for (long long int j = i; j < 1000001; j += i) phi[j] -= phi[j] / i;
}
inline long long int EXP(long long int a, long long int b, long long int mod) {
  long long int res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
inline long long int Poww(long long int a, long long int b) {
  long long int res = 1;
  while (b) {
    if (b & 1) res = res * a;
    a = a * a;
    b >>= 1;
  }
  return res;
}
inline long long int inv(long long int x, long long int mod) {
  return EXP(x, mod - 2, mod);
}
inline long long int anyinv(long long int a, long long int mod) {
  return (ok[mod]) ? EXP(a, mod - 2, mod) : EXP(a, phi[mod] - 1, mod);
}
long long int fact[1000001];
inline void Fact() {
  fact[0] = 1;
  for (int i = int(1); i < int(1000001); i++)
    fact[i] = (i * fact[i - 1]) % 1000000007;
}
inline long long int comb(long long int a, long long int b) {
  if (a < b) return 0;
  return (((fact[a] * inv(fact[b], 1000000007)) % 1000000007) *
          inv(fact[a - b], 1000000007)) %
         1000000007;
}
long long int C[1001][1001];
inline void COMB() {
  for (int i = int(0); i < int(1001); i++) {
    C[i][0] = C[i][i] = 1;
    for (int j = int(1); j <= int(i >> 1); j++)
      C[i][j] = C[i][i - j] = (C[i - 1][j] + C[i - 1][j - 1]) % 1000000007;
  }
}
int n;
int a, b[1000001], ans[1000001], res, k;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  for (int i = int(1); i <= int(n); i++) {
    cin >> a;
    cin >> b[a];
    k = max(k, a);
  }
  if (b[0]) ans[0] = res = 1;
  for (int i = int(1); i <= int(k); i++) {
    if (b[i] >= i)
      ans[i] = 1;
    else if (b[i])
      ans[i] = ans[i - b[i] - 1] + 1;
    else
      ans[i] = ans[i - 1];
    res = max(res, ans[i]);
  }
  cout << n - res << "\n";
  return 0;
}
