#include <bits/stdc++.h>
using namespace std;
int modularExponentiation(int x, int n, int M = 1000000007) {
  if (n == 0)
    return 1;
  else if (n % 2 == 0)
    return modularExponentiation((x * x) % M, n / 2, M);
  else
    return (x * modularExponentiation((x * x) % M, (n - 1) / 2, M)) % M;
}
int abs(int a, int b) {
  if (a > b)
    return a - b;
  else
    return b - a;
}
void solve();
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    solve();
  }
  return 0;
}
void solve() {
  int n;
  cin >> n;
  int x, y;
  vector<pair<int, int>> v;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    v.push_back({x, y});
  }
  sort(v.begin(), v.end());
  int dp[1000001];
  dp[0] = 0;
  int t = 0, z, ans = 1000000007;
  for (int i = 0; i < 1000001; i++) {
    if (t >= n) break;
    if (i == v[t].first) {
      if (t == 0)
        dp[i] = 1;
      else {
        z = i - (v[t].second + 1);
        if (z < 0)
          dp[i] = 1;
        else
          dp[i] = dp[z] + 1;
      }
      t++;
    } else {
      if (i) dp[i] = dp[i - 1];
    }
    ans = min(ans, n - dp[i]);
  }
  cout << ans << "\n";
}
