#include <bits/stdc++.h>
using namespace std;
int N, a[1000005], dp[1000005], x, power[1000005], p, f[1000005], res = 0;
int main() {
  memset(dp, 0, sizeof(dp));
  memset(power, 0, sizeof(power));
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d %d", &x, &p);
    power[x] = p;
  }
  dp[0] = (power[0] > 0);
  for (int i = 1; i < 1000005; i++) {
    if (power[i] > 0) {
      dp[i] = (i - power[i] - 1 >= 0 ? dp[i - power[i] - 1] : 0) + 1;
    } else {
      dp[i] = dp[i - 1];
    }
    res = max(res, dp[i]);
  }
  printf("%d\n", N - res);
}
