#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);
    n++;
}

vector <pair<int,int> > ispis;
int y=0;
int x=0;
while (k!=0  && n>2)
{
    ll val=f(n);
    if (k-val>=0)
    {
        k-=val;
        for (int i=0; i<n; i++)
           {
            ispis.push_back({y,x});
            x++;
           }
        y++;
    }
    else n--;
}

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

}