#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void read(T &x) {
  char ch = getchar();
  x = 0;
  for (; ch < '0' || ch > '9'; ch = getchar())
    ;
  for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + ch - '0';
}
const int N = 2001000;
int p[N], n, t, f[N], mx, mp, v[N];
int main() {
  read(n);
  for (int i = 1; i <= n; i++) {
    read(t);
    t += 100;
    v[t] = 1;
    read(p[t]);
    p[t] = min(p[t], t - 1);
    mp = max(mp, t);
  }
  for (int i = 1; i <= mp; i++) {
    if (!v[i])
      f[i] = f[i - 1];
    else
      f[i] = f[i - p[i] - 1] + 1;
    mx = max(f[i], mx);
  }
  printf("%d\n", n - mx);
  return 0;
}
