#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10;
int dp[N];
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    int x, y;
    cin >> x >> y;
    dp[x + 1] = y;
  }
  int l = 0, mn = 1e9;
  for (int i = 1; i < N; ++i) {
    if (dp[i]) {
      dp[i] = 1 + dp[max(0, i - dp[i] - 1)];
      mn = min(mn, n - ++l + l - dp[i]);
    } else {
      dp[i] = dp[i - 1];
    }
  }
  cout << mn;
  return 0;
}
