#include <bits/stdc++.h>
using namespace std;
long long maxx = 0;
const int MAX = 1e6 + 7;
map<long long, long long> m, m1, f1, p;
int main() {
  long long n, k, p, ta, tb, e = 0, u1 = 0, u2 = 0;
  cin >> n;
  long long a, rr;
  for (long long i = 0; i < n; i++) {
    cin >> a;
    rr = a;
    cin >> m1[a];
  }
  long long dp[MAX] = {0};
  if (m1[0] > 0) dp[0] = 1;
  for (long long i = 1; i <= MAX; i++) {
    if (m1[i] == 0) {
      dp[i] = dp[i - 1];
    } else {
      if (i - m1[i] - 1 >= 0)
        dp[i] = dp[i - m1[i] - 1] + 1;
      else {
        dp[i] = 1;
      }
    }
  }
  long long ma = 0;
  for (long long i = 0; i <= MAX; i++) {
    ma = max(ma, dp[i]);
  }
  cout << n - ma;
}
