#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005, maxm = 1000005;
int n, dp[maxm], sup;
struct _beacon {
  int pos, power;
} g[maxn];
inline int iread() {
  int f = 1, x = 0;
  char ch = getchar();
  for (; ch < '0' || ch > '9'; ch = getchar()) f = ch == '-' ? -1 : 1;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
  return f * x;
}
bool cmp(_beacon a, _beacon b) { return a.pos < b.pos; }
int check(int x) {
  int l = 1, r = n;
  while (l <= r) {
    int mid = l + r >> 1;
    if (g[mid].pos < x)
      l = mid + 1;
    else
      r = mid - 1;
  }
  if (g[l].pos == x) return l;
  return 0;
}
int main() {
  n = iread();
  for (int i = 1; i <= n; i++)
    sup = max(sup, g[i].pos = iread()), g[i].power = iread();
  sort(g + 1, g + 1 + n, cmp);
  int id = 0;
  for (int i = 0; i <= sup; i++)
    if (id = check(i)) {
      if (g[id].power < i)
        dp[i] = dp[i - g[id].power - 1] + 1;
      else
        dp[i] = 1;
    } else
      dp[i] = dp[i - 1];
  int ans = 0;
  for (int i = 1; i <= n; i++) ans = max(ans, dp[g[i].pos]);
  printf("%d\n", n - ans);
  return 0;
}
