#include <bits/stdc++.h>
using namespace std;
long kx[] = {2, -2, 2, -2, 1, -1, 1, -1};
long ky[] = {1, 1, -1, -1, 2, 2, -2, -2};
long dx[] = {1, -1, 0, 0, 1, -1, 1, -1};
long dy[] = {0, 0, 1, -1, 1, 1, -1, -1};
long dz[] = {0, 0, 0, 0, 1, -1};
const long INF = (1e9);
inline long MOD(long a, long b) {
  long res = a % b;
  return res < 0 ? res + abs(b) : res;
}
inline long Pow(long base, long exp) {
  long res = 1;
  while (exp) {
    if (exp & 1) res *= base;
    exp >>= 1;
    base *= base;
  }
  return res;
}
inline long BigMod(long base, long exp, long M) {
  base %= M;
  long res = 1;
  while (exp) {
    if (exp & 1) res = (res * base) % M;
    exp >>= 1;
    base = (base * base) % M;
  }
  return res;
}
long ar[1000009], p[1000009], idx[1000009];
long bs(long i, long key) {
  long low = 0, high = i, mid;
  while (low <= high) {
    mid = (low + high) / 2;
    if (ar[mid] == key) {
      if (mid == 0) return 0;
      return mid - 1;
    } else if (ar[mid] > key) {
      if (mid == 0) return 0;
      high = mid - 1;
    } else {
      if (ar[mid + 1] >= key) return mid;
      low = mid + 1;
    }
  }
}
long Ans[1000009];
int main() {
  long x, y, z, i, j, k, l, m, n, q, r, u, v, w, t, cas, edge, node, a, b, c, d,
      e, f, ans, cnt, ass;
  while (scanf("%ld", &n) == 1) {
    for (i = 0; i < n; i++) {
      scanf("%ld", &ar[i]);
      scanf("%ld", &p[ar[i]]);
    }
    sort(ar, ar + n);
    for (i = n - 1; i > 0; i--) {
      u = ar[i] - p[ar[i]];
      idx[i] = bs(i - 1, u);
    }
    memset(Ans, -1, sizeof(Ans));
    for (i = 1; i < n; i++) {
      j = i;
      ans = 0;
      while (j) {
        if (Ans[j] != -1) {
          ans += Ans[j];
          break;
        }
        u = ar[j] - p[ar[j]];
        if (ar[idx[j]] < u)
          ans += j - idx[j] - 1;
        else
          ans += j - idx[j];
        j = idx[j];
      }
      Ans[i] = ans;
    }
    long Min = INF;
    for (i = n - 1; i > 0; i--) {
      Min = min(Min, Ans[i] + n - i - 1);
    }
    if (Min != INF)
      printf("%ld\n", Min);
    else
      puts("0");
  }
  return 0;
}
