#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <map>
#include <list>
#include <iterator>
#include <queue>
#include <stack>
#include <deque>
#include <sstream>
#include <algorithm>
#include <numeric>
#include <string>
#include <cmath>
#include <complex>
#include <functional>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <cstdlib>
#include <cctype>

#define REP(i,m,n) for(int i=m;i<n;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define rp(i,c) rep(i,(int)c.size())
#define fr(i,c) for(__typeof((c).begin()) i=(c).begin();i!=(c).end();i++)
#define mp make_pair
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define rall(u) (u).rbegin(),(u).rend()
#define dbg(x) cerr<<#x<<" = "<<(x)<<endl
#define v_delete(a,b) (a).erase(remove((a).begin(), (a).end(), b), (a).end())
#define v_unique(a) (a).erase(unique((a).begin(), (a).end()), (a).end())
#define VV(T) vector<vector< T > >

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
const int inf=1<<28;
const double EPS=1e-9;
const long long INF = 100001000010000100ll;

template<class T>int SIZE(T a){return a.size();}
template<class T>string IntToString(T num){string res;stringstream ss;ss<<num;return ss.str();}
template<class T>T StringToInt(string str){T res=0;for(int i=0;i<SIZE(str);i++)res=(res*10+str[i]-'0');return res;}
template<class T>T gcd(T a,T b){if(b==0)return a;return gcd(b,a%b);}
template<class T>T lcm(T a,T b){return a/gcd(a,b)*b;}

template <class T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
template <class T> void input(T* a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
typedef pair<int,int> pii;


bool compare(const pii& lhs, const pii& rhs){
    if((lhs.first - lhs.second) != (rhs.first - rhs.second))
        return (lhs.first - lhs.second) > (rhs.first - rhs.second);
    else
        return lhs.second < rhs.first;
}

int N;
vector<pii>d;
vi capal;

int maxh;

class BIT{
private:
    vector<ll> bit;
    int n;
public:
    BIT(){}
    BIT(int _n){
        n = _n;
        bit.assign(n+3, 0);
    }
    void init(int _n){
        n = _n;
        bit.assign(n+3, 0);
    }
    void add(int i, int v){
        for(;i <= n; i += (i & -i))bit[i]+=v;
    }
    ll sum(int i){
        ll s=0;
        for(;i > 0;i -= (i & -i))s+=bit[i];
        return s;
    }
};

BIT kosuu;
BIT hoshutu;

bool chk(int mid, int cap){
    return kosuu.sum(mid) * cap >= hoshutu.sum(mid);
}

int main(){
    cin >> N;
    rep(i, N){
        int a,b;
        cin >> a >> b;
        maxh=max(maxh, a);
        d.pb(mp(-b, a));
        //capal.pb(b);
    }
    kosuu.init(maxh);
    hoshutu.init(maxh);

    sort(all(d));
    //sort(all(capal), greater<int>());
    //capal.erase(unique(all(capal)), capal.end());
    int cur=0;
    ll ans=0;
    rp(i, d){
        //printf("info:%d %d\n", d[i].first, d[i].second);
        kosuu.add(d[i].second, 1);
        hoshutu.add(d[i].second, d[i].second);

        int ma=maxh+1;
        int mn=0;
        while(ma - mn > 1){
            int mid=(ma+mn)/2;
            if(chk(mid, -d[i].first)){
                mn=mid;
            }else{
                ma=mid;
            }
        }

        ll k1 = kosuu.sum(mn);
        ll k2 = kosuu.sum(mn+1);
        ll s = hoshutu.sum(mn);
        for(;k1 < k2;){
        	if((k1 + 1) * (-d[i].first) < s + (mn+1)){
        		break;
        	}else{
        		//printf("%d :: %d %d\n",k1, (k1 + 1) * -d[i].first , s + (mn+1));
        		k1++;
        		s += (mn+1);
        	}
        }
        if(ans < k1){
            ans = k1;
        }
        //puts("");
        //printf("%d %d\n", kosuu.sum(mn), hoshutu.sum(mn));

    }
    cout << ans << endl;


    return 0;

}

Measured memory_bytes: 6444