#include<iostream>
#include<climits>
#include<cassert>
#include<algorithm>
#include<cassert>
#include<map>
#include<vector>
using namespace std;
#define REP(i,b,n) for(int i=b;i<n;i++)
#define rep(i,n)   REP(i,0,n)

typedef long long ll;
typedef pair<ll,ll> pll;
const int N = 300000;
//bit1ÍaAbit2ÍÂð¦é
ll bit1[N+1],bit2[N+1];

//0©çiÜÅÌaðæ¾·é
ll sum(int i,ll *bit){
  ll s = 0;
  while(i > 0){
    s += bit[i];
    i -= i&-i;
  }
  return s;
}

//iÔÚÌlÉxðÁ¦é
void add(int n,int i,int x,ll *bit){
  while(i <= n){
    bit[i] += x;
    i += i&-i;
  }
}

/*
void test(){
  int n = 10000;
  int a[n];
  rep(i,n)bit1[i] = 0;
  rep(i,n)a[i] = rand()%100,add(n,i+1,a[i],bit1);
  rep(i,n){
    int sum1 = 0;
    rep(j,i+1)sum1 += a[j];
    cout << sum1 <<" " << sum(i+1,bit1) << endl;
    assert(sum1 == sum(i+1,bit1));
  }
 
}
*/

class st{
public:
  ll a,b;
  int index;
};


/*
  úoÊðîÉµÄ\[g·éBúoÊª¬³¢ûðDæ·é
  úoÊª¯¶ÍeÊª¬³¢ûðDæ·éi½ªÇ¿çÅà¢¢)
*/
bool cmp1(const st & in1,const st & in2){
  if (in1.a != in2.a)return in1.a < in2.a; 
  return in1.b < in2.b;
}

/*
  eÊðîÉ\[gB¬³¢ûðDæ·é
  eÊª¯¶ÈçúoÊªå«¢É\[g·é
 */
bool cmp2(const st & in1,const st & in2){
  if (in1.b != in2.b)return in1.b < in2.b;
  return in1.a > in2.a;
}

/*n <= 20*/
int bf(int n,vector<st> &in){
  int ans = 0;
  rep(i,(1<<n)){
    ll minb=INT_MAX;
    ll suma=0;
    int num = __builtin_popcount(i);
    rep(j,n){
      if ((1<<j&i) == 0)continue;
      minb = min(minb,in[j].b);
      suma += in[j].a;
    }
    if (num != 0 && suma <= minb * num){//ñªTõÌãÀðã°é
      ans = max(ans,num);
    }
  }
  return ans;
}

main(){
  int n;
  bit1[0] = 0;bit2[0] = 0;
  while(cin>>n && n){
    vector<st> in(n);
    rep(i,n){
      cin>>in[i].a>>in[i].b;
      bit1[i+1] = bit2[i+1] = 0;
    }
    sort(in.begin(),in.end(),cmp1);
    //úoÊ¸ÌÝÏaðvZµÄ¨­
    rep(i,in.size()){
      add(n,i+1,in[i].a,bit1);
      add(n,i+1,1,bit2);
      in[i].index = i;
    }

    /*
      eÊÌÅ¬lðßÅ¿·éB
      úoÊiÆ»Ì½ÏjÍP²Á·éæ¤É\[gµÄaðÆÁÄ¨¢½ÌÅAQªTõãÀðßé
    */
    sort(in.begin(),in.end(),cmp2);
    int ans = 0;
    rep(i,in.size()){
      int l = 1,r = n;
      int tmp = 0;
      while(l <= r){
	int mid = (l+r)/2;
	ll tsum = sum(mid,bit1);
	ll tnum = sum(mid,bit2);
	if (tsum <= in[i].b * tnum){//ñªTõÌãÀðã°é
	  tmp = max(tmp,(int)tnum);
	  l = mid+1;
	}else {//ñªTõÌãÀðº°é
	  r = mid-1;
	}
      }
      /*
      cout <<i << " th step sum"<< endl;
      rep(j,n){
	if (j)cout <<" " ;
	double sum1 = sum(j,bit1);
	cout << sum1;
      }
      cout << endl;
      cout <<i << " th step average"<< endl;
      rep(j,n){
	if (j)cout <<" " ;
	double sum1 = sum(j,bit1),num = sum(j,bit2);
	if (num == 0)cout << 0 ;
	else cout << sum1/num ;
      }
      cout << endl;
      */
      ans = max(ans,tmp);
      /*
	iÔÚÌEBXðbit©ç¸ç·
       */
      add(n,in[i].index+1,-in[i].a,bit1);
      add(n,in[i].index+1,      -1,bit2);
    }
    cout << ans << endl;
    /*
    int tmp = bf(n,in);
    if (ans != tmp){
      rep(i,n){
	cout << in[i].a <<" " << in[i].b << endl;
      }
      cout << ans <<" "<< tmp << endl;
      assert(false);
      }
    */
  }
}

Measured memory_bytes: 11000