#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }
template<class T> void print(T a, T b) {
    for (T i = a; i != b; ++i) { if (i != a) { cout << " "; } cout << *i; } cout << endl;
}




const int MAX_N = 301000;
const int MAX_B = 210000;

int N;
pair<int,int> inp[MAX_N];

template<class T> struct BIT {   
    int SIZE_B;
    T dat[MAX_B+1];
    
    void init(int n = 1) {
        SIZE_B = n;
        for (int i = 0; i <= SIZE_B; ++i) dat[i] = 0;
    }
    
    inline void add(int a, T x) {
        for (int i = a; i <= SIZE_B; i += i & -i)
            dat[i] = dat[i] + x;
    }
    
    inline T sum(int a) {
        T res = 0;
        for (int i = a; i > 0; i -= i & -i)
            res = res + dat[i];
        return res;
    }
};

struct GRMQ {
    BIT<int> bit1;
    BIT<ll> bit2;
    
    vector<int> cur;
    map<int, int> ma;
    
    inline void init(vector<int> vec) {
        cur = vec; ma.clear();  
        sort(cur.begin(), cur.end());
        cur.erase(unique(cur.begin(), cur.end()), cur.end());
        bit1.init(cur.size()+1);
        bit2.init(cur.size()+1);
        int it = 1;
        for (int i = 0; i < cur.size(); ++i) ma[cur[i]] = it++;
    }
    
    inline void insert(int num) { bit1.add(ma[num], 1); bit2.add(ma[num], num); }
    
    inline int get(int val) {
        int res = 0;
        int N = 1; while (N <= bit1.SIZE_B) N *= 2;
        ll left_con = 0, left_sum = 0;
        for (int i = N/2; i > 0; i /= 2) {
            ll sum = left_sum + bit2.dat[res+i];
            ll con = left_con + bit1.dat[res+i];
            if (res+i <= bit1.SIZE_B && sum <= con * val) {
                left_sum = left_sum + bit2.dat[res+i];
                left_con = left_con + bit1.dat[res+i];
                res = res + i;
            }
        }

        int s1 = bit1.sum(res), s2 = bit1.sum(res+1);
        ll t1 = bit2.sum(res);
        int num = cur[res];
        
        //COUT(val); COUT(res);COUT(s1); COUT(s2);
        
        ll s = s1;
        if (s2 - s1 > 1) {
            for (s = s1; s <= s2; ++s) {
                if (t1 > s*val) break;
                t1 += num;
            }
            --s;
        }
        
        return s;
    }
};

GRMQ gr;



int main() {
    //freopen( "/Users/macuser/Dropbox/Contest/input2.in", "r", stdin );
    
    while (cin >> N) {
        for (int i = 0; i < N; ++i) cin >> inp[i].second >> inp[i].first;
        sort(inp, inp+N, greater<pair<ll,ll> >());
        
        vector<int> cur(N);
        for (int i = 0; i < N; ++i) cur[i] = inp[i].second;
        sort(ALL(cur));
        gr.init(cur);
        
        int res = 0;
        for (int i = 0; i < N; ++i) {
            int lim = inp[i].first;
            gr.insert(inp[i].second);
            
            int tmp = gr.get(lim);
            chmax(res, tmp);
        }
        
        cout << res << endl;
    }
    return 0;
}


Measured memory_bytes: 12816