#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int cf = 0;
const int mxN = (int)1e6 + 7, mod = (int)1e9 + 7, inf = (int)1e9 + 7,
          mxM = 1e3 + 7;
const long long INF = (long long)1e18 + 7;
int n;
vector<int> a(mxN + 7), b(mxN + 7), dp(mxN + 7);
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i] >> b[a[i]];
  }
  int ans = 0;
  dp[0] = (b[0] > 0);
  ans = dp[0];
  for (int i = 1; i <= mxN; 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;
    ans = max(ans, dp[i]);
  }
  cout << n - ans;
}
