#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
//const ll N=  1000000007;

/*
ll f(int n)
{
    ll val=1;
    for (int i=n-2;i<=n; i++)
        val*=i;
    val/=6;
}*/

using namespace std;

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

int k; cin >> k;


int n = 3;
ll smurf=1;
while (smurf<=k)
{
    //smurf=f(n);
    smurf=(n-2)*(n-1)*n/6;
    n++;
}

vector <pair<int,int> > ispis;
int y=0;
int broj=0;
int razmak=13337;
int start=0;
int it=2;
int temp=n;

while (k!=0  && n>2)
{
    ll val=(n-2)*(n-1)*n/6;
    if (k-val>=0)
    {
        k-=val;
        for (int i=0; i<n; i++)
           {
            int x=start+(i+1)*razmak+i;
            ispis.push_back({y,x});
            broj++;
           }
        y+=1;
        start+=it+temp;
        temp++;
        temp+=it*(it-1);
        if (y%2==0) temp*=2; else temp*=3;
        it++;
    }
    else n--;
}

cout << broj << endl;
for (int i=0; i<broj; i++)
    cout << ispis[i].first << " " << ispis[i].second << endl;


}