#include<bits/stdc++.h>
using namespace std;

struct Bug {long long a, b;};

bool ok(const vector<Bug>& bug, int n) {
  if(n == 0) return true;
  if(n == 1) return any_of(begin(bug), end(bug), [](Bug b){return b.a <= b.b;});
  priority_queue<Bug, vector<Bug>, function<bool(Bug, Bug)>> a(begin(bug) + 1, end(bug), [](Bug lhs, Bug rhs){return lhs.a != rhs.a ? lhs.a > rhs.a : lhs.b > rhs.b;});
  priority_queue<Bug, vector<Bug>, function<bool(Bug, Bug)>> b([](Bug lhs, Bug rhs){return lhs.b != rhs.b ? lhs.b > rhs.b : lhs.a > rhs.a;});
  b.push(bug.front());
  long long sum = bug.front().a;
  while(!a.empty()) {
    b.push(a.top());
    sum += a.top().a;
    a.pop();
    if(b.size() < n) continue;
    if(sum <= b.top().b * n) return true;
    sum -= b.top().a;
    b.pop();
  }
  return false;
}

int main() {
  int N;
  cin >> N;
  vector<Bug> bug(N);
  for(auto& i: bug) cin >> i.a >> i.b;

  sort(begin(bug), end(bug), [](Bug lhs, Bug rhs){return lhs.b != rhs.b ? lhs.b < rhs.b : lhs.a < rhs.a;});

  int low = 0, high = N + 1;
  while(1 < high - low) {
    int middle = (low + high) >> 1;
    (ok(bug, middle) ? low : high) = middle;
  }
  cout << low << endl;
}