#include <stdio.h>
#include <time.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <map> 
#include <string>
#include <vector>  
#include <iostream> 
#include <sstream> 
#include <queue>
#include <algorithm>
#include <assert.h>


using namespace std;

#define ll long long
#define PB 		push_back
#define FOR(a,start,end) 	for(int a=int(start); a<int(end); a++)
#define INF 		INT_MAX
#define SORT(a) 	sort(a.begin(),a.end()) 
#define CL(a,x) 		memset(a,x,sizeof(a))
#define REP(a,x)	for(int a=0;a<x;a++)
#define REP1(a,x)	for(int a=1;a<=x;a++)
#define MP 		make_pair



typedef vector<ll>     vi;
typedef pair<ll, ll>     pii;
typedef vector<string> vs;
typedef vector<pii> vii;
typedef vector<vector<ll> > vvi;
typedef vector<vector<string> > vvs;
typedef vector<pair<string, string> > vss;
typedef pair<string, string> pss;
typedef pair<ll, pii> ppii;
typedef vector<ppii> vppii;
typedef vector<vector<pii> > vvii;
typedef vector<vvi> vvvi;


ll n, k, a, b,c, z, m, d, p;
vi vk, va, vb;
vii vkx;

void dod() {
	vkx[c] = MP(b, b + 1);
	vkx[b] = MP(b + 1, -1);
	c = b + 1;
	b += 2;
}
int main() {
	//	freopen("c:\\wojtek\\uva\\pa\\debug\\ele167.in", "rt", stdin);

	cin >> k;
	vkx.assign(101,MP(-1,-1));
	vk.assign(32, 0);
	va.assign(32, 0);
	if (k == 1) {
		vkx[1] = MP(100, -1);
	}
	else {
		int j = 0;
		while (k > 0) {
			vk[j++] = k % 2;
			k /= 2;
		}
		j--;
	
		n = 100;
		a = 1;
		b = 2;
		vkx[a] = MP(b, b + 1);
		a = b;			//root
		c = b + 1;		//bieżący
		b += 2;			//pierwszy wolny
		
		for (int i = 0; i < j-1; i++) {
			va[j-i] = c;
			dod();	
		}
		va[1] = c;
		vkx[c] = MP(b, 100);
		vkx[b] = MP(100, -1);
		va[0] = n;
		b ++;
		for (int i = j - 1; i >= 0; i--) {
			if (vk[i]) {
				vkx[a] = MP(b, va[i]);
				a = b++;
			}
		}
	}


	cout << 100 << endl;
	for (int i = 1; i <= 100; i++)
		cout << vkx[i].first << " " << vkx[i].second << endl;
	return 0;

}
