#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 4;
signed main() {
  long long n;
  scanf("%lld", &n);
  vector<long long> b(N, 0), dp(N, 0);
  for (long long i = 0; i < n; i++) {
    long long a;
    scanf("%lld", &a);
    scanf("%lld", &b[a]);
  }
  dp[0] = (b[0]) ? 1 : 0;
  for (long long i = 1; i < N; i++) {
    if (!b[i])
      dp[i] = dp[i - 1];
    else
      dp[i] = 1 + ((i <= b[i]) ? 0 : dp[i - b[i] - 1]);
  }
  printf("%lld ", n - *max_element(dp.begin(), dp.end()));
  return 0;
}
