1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
 * author: pavveu
 * task: Potyczki Algorytmiczne 2020 Runda 5 - Skierowany Graf Acykliczny [C]
*/

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

#define FOR(iter, val) for(int iter = 0; iter < (val); iter++)
#define all(x) begin(x), end(x)

template<typename T>
void initialize_matrix(vector<vector<T>>& matrix, int rows, int cols, T val) {
	assert(matrix.empty());
	FOR(row, rows) 
		matrix.emplace_back(cols, val);
}



void go() {
	int k; cin >> k;
	int bits { 0 };
	while ( (1 << bits) <= k ) bits++;

	// every bit module can be made out of 3 vertices
	// + starting 3 + 1 at the end
	int n { 3 * (bits + 1) + 1 };
	cout << n << endl;
	cout << 2 << " " <<  3 << endl;

	int last = 1;

	while ( k ) {
		// last is a connector to a N vertex

		int next_connector { last + 3 };
		int next_up { last + 4 };
		int next_down { last + 5 };

		// current up
		cout << next_up << " " << next_down << "\n";
		// current down
		cout << next_up << " " << next_connector << "\n";
		// next_connector
		
		bool bit_set { k % 2 == 1 };
		int connect_n { -1 };

		if ( bit_set ) connect_n = n;

		cout << connect_n << " " << next_down << "\n";

		last += 3;
		k /= 2;
	}

	cout << -1 << " " << -1 << "\n";
	cout << -1 << " " << -1 << "\n";
	cout << -1 << " " << -1 << endl;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	go();
	// test(100);

	return 0;
}