#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int dp[N];
void solve() {
  int n;
  cin >> n;
  pair<int, int> p[n];
  for (int i = 0; i < n; ++i) {
    cin >> p[i].first >> p[i].second;
    dp[p[i].first] = p[i].second;
  }
  sort(p, p + n);
  if (dp[0]) dp[0] = 1;
  for (int i = 1; i < N; ++i) {
    if (dp[i]) {
      int val = i - dp[i];
      if (val < 1)
        dp[i] = 1;
      else
        dp[i] = dp[val - 1] + 1;
    } else
      dp[i] = dp[i - 1];
  }
  int ans = 0;
  for (int i = 0; i < N; ++i) ans = max(ans, dp[i]);
  cout << n - ans << '\n';
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int t;
  t = 1;
  while (t--) solve();
}
