#include<bits/stdc++.h>
using namespace std;
typedef long long int64;
typedef pair< int, int > Pi;
 
const int INF = 1 << 30;

int N;
Pi Bugs[300000];


int Justin()
{
  priority_queue< Pi, vector< Pi >, greater< Pi > > que;
  int64 sum = 0, ret = 0;
  for(int i = 0; i < N; i++){
    que.push( make_pair( Bugs[i].second, Bugs[i].first));
    sum += Bugs[i].first;
    while(!que.empty() && (int64)que.top().first * que.size() < sum){
      sum -= que.top().second;
      que.pop();
    }
    ret = max< int >( ret, que.size());
  }
  return(ret);
}

int main()
{
  scanf("%d", &N);
  for(int i = 0; i < N; i++){
    scanf("%d %d", &Bugs[i].first, &Bugs[i].second);
  }
  sort( Bugs, Bugs + N);
  cout << Justin() << endl;
  return(0);
}