#include <bits/stdc++.h>
using namespace std;
int dp[1000005];
int a[1000005];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    a[x] = y;
  }
  for (int i = 0; i <= 1000000; i++) {
    if (i) dp[i] = dp[i - 1];
    if (a[i]) {
      dp[i] = 1;
      if (i - a[i] - 1 >= 0) dp[i] += dp[i - a[i] - 1];
    }
  }
  int mx = -1;
  for (int i = 0; i <= 1000000; i++) mx = max(mx, dp[i]);
  cout << (n - mx);
  return 0;
}
