#include <iostream>
using namespace std;
const int maxn = 1e6 + 5;
int n, b[maxn], dp[maxn];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cin >> n;
for (int i = 0, a; i < n; i++) {
cin >> a;
cin >> b[a];
}
if (b[0] > 0) {
dp[0] = 1;
}
int mx = 0;
for (int i = 1; i < maxn; 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] > mx) {
mx = dp[i];
}
}
cout << n - mx << '\n';
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwpjb25zdCBpbnQgbWF4biA9IDFlNiArIDU7CgppbnQgbiwgYlttYXhuXSwgZHBbbWF4bl07CgppbnQgbWFpbigpIHsKICAgIGlvc19iYXNlOjpzeW5jX3dpdGhfc3RkaW8oMCk7CiAgICBjaW4udGllKE5VTEwpOwogICAgY2luID4+IG47CiAgICBmb3IgKGludCBpID0gMCwgYTsgaSA8IG47IGkrKykgewogICAgICAgIGNpbiA+PiBhOwogICAgICAgIGNpbiA+PiBiW2FdOwogICAgfQogICAgaWYgKGJbMF0gPiAwKSB7CiAgICAgICAgZHBbMF0gPSAxOwogICAgfQogICAgaW50IG14ID0gMDsKICAgIGZvciAoaW50IGkgPSAxOyBpIDwgbWF4bjsgaSsrKSB7CiAgICAgICAgaWYgKGJbaV0gPT0gMCkgewogICAgICAgICAgICBkcFtpXSA9IGRwW2kgLSAxXTsKICAgICAgICB9IGVsc2UgewogICAgICAgICAgICBpZiAoYltpXSA+PSBpKSB7CiAgICAgICAgICAgICAgICBkcFtpXSA9IDE7CiAgICAgICAgICAgIH0gZWxzZSB7CiAgICAgICAgICAgICAgICBkcFtpXSA9IGRwW2kgLSBiW2ldIC0gMV0gKyAxOwogICAgICAgICAgICB9CiAgICAgICAgfQogICAgICAgIGlmIChkcFtpXSA+IG14KSB7CiAgICAgICAgICAgIG14ID0gZHBbaV07CiAgICAgICAgfQogICAgfQogICAgY291dCA8PCBuIC0gbXggPDwgJ1xuJzsKICAgIHJldHVybiAwOwp9Cg==