#include <bits/stdc++.h>
using namespace std;
const int N = 1000006;
int n;
struct A {
  int a, b;
  bool operator<(const A& aa) const { return a < aa.a; }
} e[N];
int range[N];
int bit[N] = {};
int dp[N];
int f(int x) {
  if (x < 0) return 0;
  if (dp[x] != -1) return dp[x];
  int res = 0;
  res += range[x] + f(x - range[x] - 1);
  return dp[x] = res;
}
void add(int x) {
  for (; x <= N; x += x & (-x)) bit[x] += 1;
}
int search(int x) {
  if (x <= 0) return 0;
  int res = 0;
  for (; x > 0; x -= x & (-x)) res += bit[x];
  return res;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &e[i].a, &e[i].b);
    ++e[i].a;
    add(e[i].a);
  }
  sort(e, e + n);
  for (int i = 0; i < n; ++i)
    range[i] = search(e[i].a - 1) - search(e[i].a - e[i].b - 1);
  memset(dp, -1, sizeof(dp));
  dp[0] = 0;
  int ans = n - 1;
  for (int i = 0; i < n; ++i) ans = min(ans, f(i) + n - i - 1);
  printf("%d\n", ans);
}
