#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 10;
int n, dp[maxn], last[maxn];
pair<int, int> arr[maxn];
int main() {
  cin >> n;
  memset(last, -1, sizeof(last));
  for (int i = 0; i < n; i++) {
    cin >> arr[i].first >> arr[i].second;
  }
  sort(arr, arr + n);
  for (int i = 0; i < n; i++) {
    last[arr[i].first] = i;
  }
  for (int i = 1; i < maxn; i++) {
    if (last[i] == -1) last[i] = last[i - 1];
  }
  int mx = 1;
  dp[0] = 1;
  for (int i = 1; i < n; i++) {
    int ind = arr[i].first - arr[i].second - 1;
    if (ind < 0 || last[ind] == -1) {
      dp[i] = 1;
    } else {
      dp[i] = 1 + dp[last[ind]];
    }
    mx = max(mx, dp[i]);
  }
  cout << n - mx;
  return 0;
}
