#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int MAXN = (int)1e6 + 5;
int n, max1, dp[MAXN], a[MAXN], x;
int main() {
  scanf("%d", &n);
  max1 = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    scanf("%d", &a[x]);
    max1 = (x) > (max1) ? (x) : (max1);
  }
  if (a[0]) dp[0] = 1;
  for (int i = 1; i <= max1; i++) {
    if (!a[i])
      dp[i] = dp[i - 1];
    else if (a[i] >= i)
      dp[i] = 1;
    else
      dp[i] = dp[i - a[i] - 1] + 1;
  }
  int ans = n;
  for (int i = 0; i <= max1; i++)
    ans = (ans) < (n - dp[i]) ? (ans) : (n - dp[i]);
  printf("%d", ans);
  return 0;
}
