#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
pair<long long, long long>x[1 << 19];
long long bit[2][1 << 19], n, g[1 << 19];
void add(long long q, long long a, long long x) {
	while (a <= 400000) {
		bit[q][a] += x;
		a += a&-a;
	}
}
long long sum(long long q, long long a) {
	long long s = 0;
	while (a >= 1) {
		s += bit[q][a];
		a -= a&-a;
	}
	return s;
}
bool solve(long long g, long long p) {
	if (sum(1, g) == 0)return true;
	long long K = (sum(0, g) - 1) / sum(1, g);
	if (K >= p)return false;
	return true;
}
int main() {
	cin >> n; vector<pair<long long, long long> >vec;
	for (long long i = 0; i < n; i++) {
		cin >> x[i].second >> x[i].first;
	}
	sort(x, x + n);long long maxn = 0;
	for (int i = 0; i < n; i++) {
		vec.push_back(make_pair(x[i].second, i));
	}
	sort(vec.begin(), vec.end());
	for (int i = 0; i < n; i++) {
		g[vec[i].second] = i + 1;
	}
	for (long long i = n - 1; i >= 0; i--) {
		add(0, g[i], x[i].second);
		add(1, g[i], 1);
		long long L = 1, R = 320000, M, C = 0;
		while (true) {
			M = (L + R) / 2;
			bool V1 = solve(M - 1, x[i].first);
			bool V2 = solve(M, x[i].first);
			if (V1 == true && V2 == false) {
				C = sum(1, M - 1); break;
			}
			if (V1 == true && V2 == true)L = M;
			if (V1 == false && V2 == false)R = M;
			if (M >= 310000 && V1 == true && V2 == true) {
				C = sum(1, 310000); break;
			}
		}
		maxn = max(maxn, C);
	}
	cout << maxn << endl;
	return 0;
}