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
#include <iostream>

using namespace std;

int last;
int c = 1;

void foo(int x) {
	if (x == 1) return;
	cout << c + 1 << " " << c + 2 << "\n";
	if (x % 2 == 1)
		cout << c + 3 << " " << last << "\n";
	else
		cout << c + 3 << " -1\n";
	cout << c + 3 << " -1\n";
	c += 3;
	foo(x / 2);
}

int main()
{
	int n;
	cin >> n;
	int n2 = 0;
	int tmp = n;
	while (tmp != 1) {
		n2++;
		tmp /= 2;
	}

	last = 2 + 3 * n2;

	cout << last << "\n";
	foo(n);
	cout << last << " -1\n-1 -1";
}