#include <bits/stdc++.h>
using namespace std;
const long long maxn = 1e6 + 50;
long long a[maxn], b[maxn], dp[maxn];
pair<long long, long long> p[maxn];
signed main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
  long long n;
  cin >> n;
  for (long long i = 1; i <= n; i++) {
    cin >> p[i].first >> p[i].second;
  }
  sort(p + 1, p + n + 1);
  for (long long i = 1; i <= n; i++) {
    a[i] = p[i].first;
    b[i] = p[i].second;
  }
  for (long long i = 2; i <= n; i++) {
    long long t = a[i] - b[i];
    auto it = lower_bound(a + 1, a + i + 1, t);
    long long k = *it;
    if (a[i] == k)
      dp[i] = dp[i - 1];
    else {
      long long val = i - (it - a);
      dp[i] = dp[i - val - 1] + val;
    }
  }
  long long ans = 0x3f3f3f3f;
  for (long long i = 1; i <= n; i++) {
    ans = min(ans, dp[i] + n - i);
  }
  cout << ans << "\n";
}
