#include <bits/stdc++.h>
using namespace std;
const long long logN = 20;
const long long M = 1000000007;
const long long INF = 1e12;
int pow1(int a, int b) {
  int res = 1;
  while (b > 0) {
    if (b & 1) {
      res = res * a;
    }
    a = a * a;
    b >>= 1;
  }
  return res;
}
int main() {
  long long dp[1000005] = {0};
  vector<long long> x(1000005, 0);
  long long n;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    long long a, b;
    cin >> a >> b;
    x[a] = b;
  }
  if (x[0] != 0)
    dp[0] = 1;
  else
    dp[0] = 0;
  for (long long i = 1; i < 1000005; i++) {
    if (x[i] == 0)
      dp[i] = dp[i - 1];
    else {
      if (i - x[i] - 1 >= 0)
        dp[i] = (dp[i - x[i] - 1] + 1);
      else
        dp[i] = 1;
    }
  }
  long long mn = 0;
  for (long long i = 0; i < 1000005; i++) {
    if (x[i] != 0) {
      if (dp[i] > mn) {
        mn = dp[i];
      }
    }
  }
  cout << n - mn;
}
