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

int n;

int g=0,p=3,bri=0,x,br=1;

int ispis[100000009],niz[100000009];

int main () {

    cin>>n;

    niz[1]=0;
    niz[2]=0;
    niz[3]=1;

    for (int i=3;i<=n;i++){

        x=i*(i-1)*(i-2);

        niz[i]=x/6;
    }

    while (n>0){

 p++;

        if (niz[p]>n){



            ispis[br]=p-1;

            br++;

            bri+=p-1;


                n-=niz[p-1];





//            cout<<endl;
//            cout<<"ispis[br] "<<ispis[br]<<endl;
//            cout<<"p "<<p<<endl;
//            cout<<"niz[p] "<<niz[p]<<endl;
//            cout<<"niz[p-1] "<<niz[p-1]<<endl;
//            cout<<"n "<<n<<endl;

            p=3;

        }

        if (niz[p]==n){



            ispis[br]=p;

            br++;

            bri+=p;


//            cout<<endl;
//            cout<<"ispis[br] "<<ispis[br]<<endl;
//            cout<<"p "<<p<<endl;
//            cout<<"niz[p] "<<niz[p]<<endl;
//            cout<<"niz[p-1] "<<niz[p-1]<<endl;
//            cout<<"n "<<n<<endl;




                break;

        }






    }


    cout<<bri<<endl;

    for (int i=1;i<=br;i++){


        for (int j=1;j<=ispis[i];j++){

            cout<<g<<" "<<j<<endl;
        }


        g+=2;
    }



return 0;
}