#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    vector<pair<int, int>> v;
    int i, a, b, index = 0, dp[1000005] = {0}, ans = INT_MIN, n;
    cin >> n;
    for (long long int i = 0; i < n; i++) {
      cin >> a >> b;
      v.push_back({a, b});
    }
    sort((v).begin(), (v).end());
    for (i = 0; i < n; i++) {
      while (index != v[i].first) {
        dp[index] = dp[max(0, index - 1)];
        index++;
      }
      if (index - v[i].second - 1 < 0)
        dp[index] = 1;
      else
        dp[index] = dp[index - v[i].second - 1] + 1;
      ans = max(ans, dp[index]);
      index++;
    }
    cout << n - ans;
  }
  return 0;
}
