#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n,brTrojka=0,d=2,i=2,brSegmenta=0,x=0,y=0;
    cin>>n;
    int duzinaSegment[2000];
    duzinaSegment[0]=3;
    while(brTrojka!=n){
        i++;
        d++;
        if(brTrojka+(d*(d-1)*(d-2)/6)>n){
            brTrojka+=((d-1)*(d-2)*(d-3)/6);
            i+=1;
            duzinaSegment[brSegmenta++]=d-1;
            d=3;
        }
        if(brTrojka+(d*(d-1)*(d-2)/6)==n){
            duzinaSegment[brSegmenta++]=d-1;
            break;
        }
    }
    cout << i << endl;
    for(int br2=0;br2<=duzinaSegment[0];br2++){
            y+=0;
            cout<< x++ << ' ' << y <<endl;
    }
    for(int br1=1;br1<brSegmenta;br1++){
        for(int br2=0;br2<duzinaSegment[br1];br2++){
            y+=br1;
            cout<< x++ << ' ' << y <<endl;
        }

    }
    return 0;
}