#include <bits/stdc++.h>
using namespace std;
int t[1000005], r = 1000004;
int dp[1000005];
int main() {
  memset(dp, 0, sizeof(dp));
  memset(t, 0, sizeof(t));
  int n, ans = 0, x;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    cin >> t[x];
  }
  dp[0] = 0;
  if (t[0] != 0) dp[0] = 1;
  for (int i = 1; i <= r; i++) {
    if (!t[i])
      dp[i] = dp[i - 1];
    else {
      if (t[i] >= i)
        dp[i] = 1;
      else
        dp[i] = dp[i - t[i] - 1] + 1;
    }
    ans = max(ans, dp[i]);
  }
  cout << n - ans;
  return 0;
}
