#include <bits/stdc++.h>
using namespace std;
const int N = 1000005;
int powe[N], dp[N];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int foo, foof;
    scanf("%d %d", &foo, &foof);
    powe[foo] = foof;
  }
  int res = N, cnt = 0;
  for (int i = 0; i < N; ++i) {
    if (powe[i]) {
      ++cnt;
      if (i - powe[i] - 1 >= 0) {
        dp[i] = 1 + dp[i - powe[i] - 1];
      } else {
        dp[i] = 1;
      }
      res = min(res, n - dp[i]);
    } else {
      dp[i] = (i > 0) ? dp[i - 1] : 0;
    }
  }
  printf("%d\n", res);
  return (0);
}
