#include <bits/stdc++.h>
using namespace std;
long long arr[1000050], dp[1000050], n, a, b;
int main() {
  memset(dp, 0, sizeof dp);
  cin >> n;
  long long arrSz = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a >> b;
    arr[a] = b;
    arrSz = max(arrSz, a);
  }
  if (arr[0] > 0) dp[0] = 1;
  long long mx = dp[0];
  for (long long i = 1; i <= arrSz; i++) {
    if (arr[i] == 0) {
      dp[i] = dp[i - 1];
    } else if (arr[i] >= i) {
      dp[i] = 1;
    } else {
      dp[i] = dp[i - arr[i] - 1] + 1;
    }
    mx = max(mx, dp[i]);
  }
  cout << n - mx << "\n";
  return 0;
}
