#include <bits/stdc++.h>
using namespace std;
const int MAX_SIZE = 1000010;
int used[MAX_SIZE];
int b[MAX_SIZE];
int cnt[MAX_SIZE];
int dp[MAX_SIZE];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    int a, x;
    scanf("%d %d", &a, &x);
    used[a] = 1;
    b[a] = x;
  }
  for (int i = 0; i < MAX_SIZE; ++i) {
    cnt[i] = ((i == 0) ? 0 : cnt[i - 1]) + used[i];
  }
  for (int i = 1; i < MAX_SIZE; ++i) {
    if (i - b[i] - 1 < 0) {
      dp[i] = cnt[i - 1];
    } else {
      dp[i] = cnt[i - 1] - cnt[i - b[i] - 1] + dp[i - b[i] - 1];
    }
  }
  int answer = MAX_SIZE;
  int sum = 0;
  for (int i = MAX_SIZE - 1; i >= 0; --i) {
    if (used[i]) {
      answer = min(answer, sum + dp[i]);
      ++sum;
    }
  }
  if (answer == MAX_SIZE) {
    answer = sum;
  }
  printf("%d", answer);
  return 0;
}
