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

using namespace std;

int K;

int main() {
	scanf("%d", &K);

	int v = 1, w = 0;
	while (v <= K) {
		w++;
		v *= 2;
	}

	w = 2 * w;
	printf("%d\n", w);

	v = 2;
	while (K > 1) {
		printf("%d %d\n", v, v + 1);
		printf("%d %d\n", v + 1, K % 2 ? w : -1);
		K /= 2;
		v += 2;
	}

	printf("%d -1\n", w);
	printf("-1 -1\n");

	return 0;
}