#include <bits/stdc++.h>
using namespace std;
typedef struct x {
  int cor;
  int power;
  bool operator<(x T) const { return cor < T.cor; }
} beacon;
beacon arr[2000009];
vector<int> tmp;
int dp[2000009];
int main() {
  int n, m, k;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", &arr[i].cor, &arr[i].power);
  }
  sort(arr, arr + n);
  for (int i = 0; i < n; i++) tmp.push_back(arr[i].cor);
  dp[0] = 0;
  for (int i = 1; i < n; i++) {
    int p = arr[i].power;
    int left = arr[i].cor - p;
    vector<int>::iterator it = lower_bound(tmp.begin(), tmp.end(), left);
    int l = it - tmp.begin();
    dp[i] = (i - l);
    if (l > 0) dp[i] += dp[l - 1];
  }
  int ans = INT_MAX;
  for (int i = 0; i < n; i++) {
    ans = min(ans, dp[i] + (n - i - 1));
  }
  printf("%d\n", ans);
}
