#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6 + 6;
int num = 0;
int k[MAX];
int temp[MAX];
int final = 0;
int main(int argc, char const *argv[]) {
  scanf("%d", &num);
  for (int i = 0; i < num; i++) {
    int a = 0;
    int b = 0;
    scanf("%d%d", &a, &b);
    temp[a] = b;
  }
  for (int j = 0; j <= 1e6; j++) {
    int x = j - temp[j] - 1;
    if (x < 0)
      k[j] = 0;
    else
      k[j] = k[x];
    if (temp[j]) k[j]++;
    if (k[j] > final) final = k[j];
  }
  printf("%d\n", num - final);
  return 0;
}
