#include <bits/stdc++.h>

#define pb push_back
#define MAXN 1000000000

using namespace std;

long long k;
vector<long long> duz;
vector< pair<long long, long long> > ress;

long long bs(long long b)
{
    long long ress;
    int l=3, r=1000;
    while (l<=r)
    {
        long long mid=l+(r-l)/2;
        if ((mid*(mid-1)*(mid-2)/6)<=b)
        {
            ress=mid;
            l=mid+1;
        }
        else r=mid-1;
    }
    return ress;
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    cin>>k;

    long long cnt=0, brIsk=0;
    while (k)
    {
        long long x=bs(k);
        k-=((x-2)*(x-1)*x)/6;
        duz.pb(x-1);
        brIsk+=x;
        //cout<<x<<endl;
        cnt++;
    }
    //cout<<cnt<<" "<<brIsk<<endl;
    //cout<<duz.size()<<" "<<duz[0]<<" "<<duz[1]<<endl;

    cout<<brIsk/*+3*(int)(k==1)*/<<endl;
    for (int i=0; i<=duz[0]; i++)
        ress.pb({i,0});
    if (duz.size()>=2)
        for (int i=duz[0]; i<=duz[0]+duz[1]; i++)
            ress.pb({i,1});

    long long tDuz=duz[0]+duz[1];
    for (int i=2; i<duz.size(); i++)
    {
        for (int j=tDuz*2+1; j<=tDuz*2+duz[i]+1; j++)
            ress.pb({j,i});
        tDuz=tDuz*2+duz[i]+1;
    }

    for (int i=0; i<ress.size(); i++)
    {
        cout<<ress[i].first-MAXN<<" "<<ress[i].second<<endl;
    }

    /*if (k>0)
    {
        cout<<tDuz*2+1<<" "<<duz.size()<<endl;
        cout<<tDuz*2+2<<" "<<duz.size()<<endl;
        cout<<tDuz*2+3<<" "<<duz.size()<<endl;
    }*/
}