#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 7;
pair<int, int> p[N];
long long int a[N], b[N], dp[N];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    p[i].first = a[i];
    p[i].second = b[i];
  }
  sort(p, p + n);
  sort(a, a + n);
  memset(dp, 0, sizeof(dp));
  for (int i = 0; i < n; i++) {
    int x = lower_bound(a, a + n, p[i].first - p[i].second) - a;
    if (x == 0) {
      dp[i] = i - x;
    } else {
      dp[i] = dp[x - 1] + i - x;
    }
  }
  long long int ans = dp[n - 1];
  for (long long int i = 0; i < n; i++) {
    ans = min(ans, dp[i] + n - i - 1);
  }
  cout << ans;
  return 0;
}
