#include <bits/stdc++.h>
using namespace std;
long long int maxx(long long int a, long long int b) {
  if (a >= b) return a;
  return b;
}
void solve() {
  long long int n;
  cin >> n;
  map<long long int, long long int> mark;
  map<long long int, long long int> jaffa;
  long long int a[n], b[n];
  map<long long int, long long int> dp;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    mark[a[i]]++;
    jaffa[a[i]] = b[i];
  }
  long long int maxi = 0;
  for (int i = 0; i < 1000001; i++) {
    if (mark[i] != 0) {
      if (i > jaffa[i])
        dp[i] = 1 + dp[i - jaffa[i] - 1];
      else
        dp[i] = 1;
      maxi = maxx(maxi, dp[i]);
    } else {
      if (i != 0)
        dp[i] = dp[i - 1];
      else
        dp[i] = 0;
    }
  }
  cout << n - maxi;
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
