#include <bits/stdc++.h>
#define mod 1000000007
#define pb push_back
#define mid(l, r) ((l)+(r))/2
#define len(a) (a).length()
#define sz(a) (a).size()
#define xx first
#define yy second
#define inf int(2e9)
#define ff(i, a, b) for(int (i) = (a); (i) <= (b); ++(i))
#define fb(i, a, b) for(int (i) = (a); (i) >= (b); --(i))


using namespace std;

typedef long long ll;
typedef pair<int,int> pii;

template<class T>
void print(const T niz[], const int siz)
{
    for(int i=0;i<siz;i++)
        cout << niz[i] << " ";
    cout << endl;
}

ll n;
bool ista = 0;
vector<pii>sol;
int lastlvl = 0;
int lastdod = 0;
int lastx = 0;
void ubaci(int kolko){
    if(!ista){
        for(int i=0; i<=kolko - 1; i++){
            sol.pb({i,i});
        }
        lastlvl = kolko-1;
        lastdod = 1;
        lastx = kolko-1;
        ista = 1;
    }
    else{
        kolko--;
        int trlvl = lastlvl+1;
        lastdod++;
        int trx = trlvl * lastdod;
        for(int i=0; i<kolko; i++){
            sol.pb({trx,trlvl});
            trx += lastdod;
            trlvl++;
        }
        trlvl--;
    }
}
ll nck(ll x){
    ll sta = (x) * (x - 1) * (x - 2);
    sta /= 6;
    return sta;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n;
    ll i = 1005;
    while(n > 0){
        ll sta = nck(i);
        if(sta > n){
            i--;
            continue;
        }
        n -= sta;
        ubaci(i);
    }
    cout << sol.size() << endl;
    for(auto c:sol) cout << c.xx  << " " << c.yy << endl;
    return 0;
}