#include <bits/stdc++.h>
using namespace std;
long arr[1000005];
long dp[1000005];
int main() {
  long n;
  cin >> n;
  memset(arr, 0, sizeof(arr));
  for (int i = 0; i < n; i++) {
    int val, x;
    cin >> val >> x;
    arr[val] = x;
  }
  long ans = 0;
  if (arr[0])
    dp[0] = 1;
  else
    dp[0] = 0;
  for (int i = 1; i < 1000005; i++) {
    if (arr[i] > 0) {
      if (arr[i] >= i)
        dp[i] = 1;
      else
        dp[i] = 1 + dp[i - arr[i] - 1];
    } else
      dp[i] = dp[i - 1];
    ans = max(ans, dp[i]);
  }
  cout << n - ans;
  return 0;
}
