#include <bits/stdc++.h>
using namespace std;

struct ios
{
    inline char read()
    {
        static const int IN_LEN = 1e6 + 10;
        static char buf[IN_LEN], *s, *t;
        return (s == t) && (t = (s = buf) + fread(buf, 1, IN_LEN, stdin)), s == t ? -1 : *s++;
    }
    template <typename _Tp>
    inline ios &operator>>(_Tp &x)
    {
        static char c11, boo;
        for (c11 = read(), boo = 0; !isdigit(c11); c11 = read())
        {
            if (c11 == -1)
                return *this;
            boo |= c11 == '-';
        }
        for (x = 0; isdigit(c11); c11 = read())
            x = x * 10 + (c11 ^ '0');
        boo && (x = -x);
        return *this;
    }
} io;

namespace IO
{
    template <typename T>
    inline void w(T x)
    {
        if (x > 9)
            w(x / 10);
        putchar(x % 10 + 48);
    }
    template <typename T>
    inline void write(T x, char c)
    {
        if (x < 0)
            putchar('-'), x = -x;
        w(x);
        putchar(c);
    }
    template <typename T>
    inline void read(T &x)
    {
        x = 0;
        T f = 1;
        char c = getchar();
        for (; !isdigit(c); c = getchar())
            if (c == '-')
                f = -1;
        for (; isdigit(c); c = getchar())
            x = (x << 1) + (x << 3) + (c ^ 48);
        x *= f;
    }
} // namespace IO

#define int long long
#define x first
#define y second
#define PII pair<int,int>
#define LL long long
#define pb push_back
#define pqp priority_queue<PII,vector<PII>,greater<PII>>
#define pqi priority_queue<int,vector<int>,greater<int>>
#define PSS pair<string,string>
#define in insert
#define line inline
// #define sort(s) sort(s.begin(),s.end());
#define reverse(s) reverse(s.begin(),s.end());
#define max_(s) *max_element(s.begin(), s.end())
#define V vector<int>
#define VV vector<V>
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);

int dx[]=  {0,-1,0,1,0,0},dy[]= {-1,0,1,0,0,0},dz[] = {0,0,0,0,-1,1};

int n;
bool check(int a,int b,int c)
{
    return a * b * c <= n;
}

void solve()
{
    cin >> n;
    int sum = 0;
	for(int i = 1; i <= n; i ++){
	  	  int k = n / i;
	  	  for(int j = 1; j <= k; j++){
	  	  	 sum += (k/j);
		  }
	  }
	  printf("%lld\n",sum);
}

signed main()
{
    // IOS
    // int _; cin >> _; while(_ --)

    solve();
}

#include<bits/stdc++.h>
using namespace std;
#define arep(i,x,n) for(int i=int(x);i<(int)(n);i++)
#define rep(i,n) for(long long i = 0;i < n;++i)
#define rrep(i,n) for(int i=int(n-1);i>=0;i--)
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define coy cout<<"Yes"<<endl
#define con cout<<"No"<<endl
#define pi 3.141592653589793
#define eps 0.00000001
#define INF 1e9+7
#define LINF 1e18+10  
using ll = long long;

using P = pair<ll, ll>;
using fP = pair<double, double>;
using PPI = pair<P, int>;
using PIP = pair<int, P>;
using Ps = pair<int, string>;

using vi = vector<int>;
using vl = vector<ll>;
using vc = vector<char>;
using vd = vector<double>;
using vs = vector<string>;
using vp = vector<P>;
using vb = vector<bool>;
using vvi = vector<vector<int>>;
using vvl = vector<vector<ll>>;
using vvd = vector<vector<double>>;
using vvc = vector<vector<char>>;
using vvp = vector<vector<P>>;
using vvb = vector<vector<bool>>;
template <typename T>
bool chmax(T& a, const T b) { if (a < b) { a = b; return true; } return false; }
template <typename T>
bool chmin(T& a, const T b) { if (a > b) { a = b; return true; } return false; }

//const ll mod=998244353;
const ll mod = 1e9 + 7;
const ll MAX = 300000;
template <typename T>
T abs(T a) { if (a < 0)return -a; else return a; }//2020/09/30 stdlib has abs(long) abs(long long) error

//////////////////////////////////////

int main() {
    int n;
    cin >> n;
    vp ab(n);

    vp tmp(n);

    rep(i, n) {
        cin >> ab[i].fs >> ab[i].sc;
        tmp[i].fs = 2 * ab[i].fs + ab[i].sc;
        tmp[i].sc = i;
    }
    sort(rall(tmp));

    vl ad(n), iad(n + 1);

    ad[0] = (ll)ab[tmp[0].sc].fs + ab[tmp[0].sc].sc;
    rep(i, n - 1) {
        P p = ab[tmp[i + 1].sc];
        ad[i + 1] = ad[i] + p.fs + p.sc;
    }

    iad[n - 1] = ab[tmp[n - 1].sc].fs;
    rep(i, n - 1) {
        P p = ab[tmp[n - 1 - (i + 1)].sc];
        iad[n - 1 - (i + 1)] = iad[n  - (i + 1)] + p.fs;
    }

    rep(i, n) {
        ll a = ad[i];
        ll b = iad[i + 1];
        if (a > b) {
            cout << i + 1 << endl;
            return 0;
        }
    }
}