#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int main()
{
    ios_base::sync_with_stdio(false);
    ll K, s=0, p=2, c=0, n1=0; cin >> K;
    vector<pair<ll,ll>> r;
    while(K) {
        ll n = 3;
        while(n*(n-1)*(n-2)<=6*K) n++; n--;
        if(!n1) n1=n;
        for(ll i=0;i<n;i++)
            r.push_back({s+i,c});
        s+=p*n1; p<<=1; c++; n1++;
        K-=n*(n-1)*(n-2)/6;
    }
    cout << r.size() << endl;
    for(ll i=0;i<r.size();i++)
        cout << r[i].first << " " << r[i].second << endl;
    return 0;
}