#include <iostream>
#include<bits/stdc++.h>
using namespace std;
vector<pair<int,int> > rez;
vector<int>  v;
bool changed[1000001];
int minimum[1000001],maximum[1000001];
//map<int,int> m[1000001];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int k,poc,kraj,sred,br=0,i,j,l,r;
    cin >> k;
    while(k>0)
    {
        poc=3;
        if(k<4)
            kraj=3;
        else
            kraj=min(1001,k);
        while(poc<=kraj)
        {
            sred=(poc+kraj)/2;
            if(((long long)sred*(long long)(sred-1)*(long long)(sred-2))/6<=(long long)k && ((long long)(sred+1)*(long long)sred*(long long)(sred-1))/6>(long long)k)
                break;
            else
            {
                if(((long long)sred*(long long)(sred-1)*(long long)(sred-2))/6>(long long)k)
                    kraj=sred-1;
                else
                    poc=sred+1;
            }
        }
        br=br+sred;
        v.push_back(sred);
        k=k-(long long)sred*(long long)(sred-1)*(long long)(sred-2)/6;
    }
    cout << br << endl;
    changed[0]=true;
    minimum[0]=-1000000000;
    maximum[0]=-1000000000+v[0]-1;
    for(i=0;i<v[0];i++)
        rez.push_back(make_pair(0,minimum[0]+i));
    for(i=1;i<v.size();i++)
    {
        if(changed[i]==false)
        {
            minimum[i]=-1000000000;
            maximum[i]=-1000000000+v[i]-1;;
            changed[i]=true;
        }
        else
            maximum[i]=minimum[i]+v[i]-1;
        for(j=minimum[i];j<=maximum[i];j++)
            rez.push_back(make_pair(i,j));
        for(j=0;j<i;j++)
        {
            for(k=i+(i-j);k<v.size();k=k+(i-j))
            {
                if(changed[k]==false)
                {
                    minimum[k]=maximum[i]+((k-i)/(i-j))*(maximum[i]-minimum[j])+1;
                    changed[k]=true;
                }
                else
                    minimum[k]=max(maximum[i]+((k-i)/(i-j))*(maximum[i]-minimum[j])+1,minimum[k]);
            }
        }
    }
    for(i=0;i<br;i++)
        cout << rez[i].first << " " << rez[i].second << endl;
    return 0;
}