#include <bits/stdc++.h>
using namespace std;
const int maxn = 1000105;
const int inf = 1 < 28;
int b[maxn], dp[maxn];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    cin >> b[x];
  }
  if (b[0]) dp[0] = 1;
  int mx = 0;
  for (int i = 1; i < maxn; i++) {
    if (!b[i]) {
      dp[i] = dp[i - 1];
    } else {
      if (b[i] >= i)
        dp[i] = 1;
      else
        dp[i] = dp[i - b[i] - 1] + 1;
    }
    mx = max(mx, dp[i]);
  }
  cout << n - mx << '\n';
  return 0;
}
