#include <bits/stdc++.h>
using namespace std;
bool compare(pair<int, int> a, pair<int, int> b) { return a.first < b.first; }
int main() {
  int n;
  cin >> n;
  vector<pair<int, int>> vec(n);
  for (int i = 0; i < n; i++) cin >> vec[i].first >> vec[i].second;
  int* dp = new int[1000043];
  int j = 0;
  sort(vec.begin(), vec.end(), compare);
  if (vec[0].first == 0) {
    dp[0] = 1;
    j++;
  } else
    dp[0] = 0;
  for (int i = 1; i <= vec[n - 1].first; i++) {
    if (i == vec[j].first) {
      int d = i - vec[j].second - 1;
      if (d < 0)
        dp[i] = 1;
      else
        dp[i] = dp[d] + 1;
      j++;
    } else
      dp[i] = dp[i - 1];
  }
  int maxval = 0;
  for (int i = 0; i < n; i++) maxval = max(dp[vec[i].first], maxval);
  cout << n - maxval;
}
