#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 7;
const long long INF = 1e9 + 7;
pair<int, int> a[N];
int d[N];
int main() {
  ios_base::sync_with_stdio(0);
  int n, ans = INF, t;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i].first >> a[i].second;
  sort(a, a + n);
  for (int i = 0; i < n; i++) {
    int l = 0, r = i;
    while (l < r - 1) {
      int m = (l + r) / 2;
      if (a[m].first < a[i].first - a[i].second)
        l = m;
      else
        r = m;
    }
    t = r;
    if (a[0].first >= a[i].first - a[i].second) t = 0;
    d[i] = d[max(t - 1, 0)] + i - t;
    ans = min(ans, d[i] + n - i - 1);
  }
  cout << ans;
  return 0;
}
