#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 3;
using namespace std;
long long b[N], dp[N];
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0);
  int n;
  cin >> n;
  long long a;
  for (int i = 0; i < n; i++) {
    cin >> a;
    cin >> b[a];
  }
  if (b[0] > 0) dp[0] = 1;
  long maxn = dp[0];
  for (int i = 1; i < N; i++) {
    if (b[i] == 0)
      dp[i] = dp[i - 1];
    else {
      if (b[i] >= i)
        dp[i] = 1;
      else
        dp[i] = dp[i - b[i] - 1] + 1;
      if (dp[i] > maxn) maxn = dp[i];
    }
  }
  cout << n - maxn << endl;
}
