import std.stdio;
import std.conv;
import std.string;
import std.array;
import std.algorithm;
import std.range;
import std.typecons;

class Bit(Type){
	Type[] data;
	size_t size;
	this(int s){
		SetSize(s);
	}
	void SetSize(size_t s){
		data = new Type[s];
		size = s;
		data[] = 0;
	}
	void add(size_t idx,Type value){
		if(idx >= size)
			return;
		data[idx] += value;
		add(idx + ((idx+1) & (-idx-1)),value);
	}
	Type sum(size_t idx){
		if(idx == size_t.max)
			return 0;
		if(idx >= size)
			idx = size;
		return data[idx] + sum(idx - ((idx+1) & (-idx-1)));
	}
	Type sum(size_t from,size_t to){
		return sum(to) - sum(from-1);
	}
}

int[] rdi(){
	return readln.split.map!(to!int).array;
}

void main(){
	int n = rdi[0];
	int[] releasefoo;
	int[] allowfoo;
	int[] indices;
	foreach(i;0..n){
		auto ab = rdi;
		releasefoo ~= ab[0];
		allowfoo ~= -ab[1];
		indices ~= i;
	}
	sort(zip(releasefoo,allowfoo,indices));
	Bit!long releasebit = new Bit!long(n);
	int[] releasebitidx = new int[n];
	foreach(i;0..n){
		releasebitidx[indices[i]] = i; 
	}
	sort(zip(allowfoo,releasefoo,indices));
	Bit!int bugcountbit = new Bit!int(n);
	int res=0;
	foreach(i;0..n){
		releasebit.add(releasebitidx[indices[i]],releasefoo[i]);
		bugcountbit.add(releasebitidx[indices[i]],1);
/*
		writeln(-allowfoo[i]," ",releasefoo[i]);
		double[] tmprb;
		foreach(j;0..n)
			tmprb ~= cast(double)releasebit.sum(j) / bugcountbit.sum(j);
		tmprb.writeln;
		int[] tmpbc;
		foreach(j;0..n)
			tmpbc ~= bugcountbit.sum(j);
		tmpbc.writeln;
*/
		double minallow = -allowfoo[i];
		int base = -1;
		int s = n+1;
		while(s > 1){
			int p = s;
			s = s/2;
			double allowsum = cast(double)releasebit.sum(base + s) / bugcountbit.sum(base + s);
			if(allowsum <= minallow){
				base += s;
				s = p-s;
			}
		}
		int nbc = bugcountbit.sum(base);
		//(base).writeln;
		res = max(res,nbc);
	}
	res.writeln;
}