#include <bits/stdc++.h>
using namespace std;
long long b = 0, c = 0, s = 0;
long long nb, ns, nc;
long long rb, rs, rc;
long long r;
bool possible(long long m) {
  if (max((m * b - nb), 0LL) * rb + max((m * c - nc), 0LL) * rc +
          max((m * s - ns), 0LL) * rs <=
      r)
    return 1;
  else
    return 0;
}
const int maxn = 1000000 + 3;
int vec[maxn];
int dp[maxn];
int main() {
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    vec[a] = b;
  }
  if (vec[0] > 0) dp[0] = 1;
  int maxdp = 0;
  for (int i = 1; i < maxn; i++) {
    if (vec[i] != 0) {
      if (vec[i] >= i)
        dp[i] = 1;
      else
        dp[i] = dp[i - vec[i] - 1] + 1;
    } else {
      dp[i] = dp[i - 1];
    }
    maxdp = max(maxdp, dp[i]);
  }
  cout << n - maxdp;
  return 0;
}
