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
77
78
79
80
81
82
#define _CRT_SECURE_NO_WARNINGS 1
#define _WINSOCK_DEPRECATED_NO_WARNINGS 1

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <queue>
#include <map>

using namespace std;



int main()
{
	long long n;

	scanf("%lld", &n);
	int k1[101];
	int k2[101];
	for (int i = 0; i < 101; ++i)
	{
		k1[i] = -1;
		k2[i] = -1;
	}
	k1[99] = 100;
	k1[98] = 100;
	for (int i = 40; i < 98; ++i)
	{
		int delta = i % 2 == 0 ? 2 : 1;
		int k1d = i + delta;
		int k2d = i + delta + 1;
		k1[i] = k1d;
		k2[i] = k2d;
	}

	int map[33];
	int j = 98;
	for (int i = 1; i <32; ++i)
	{
		map[i] = j;
		j -= 2;
	}

	for (int i = 1; i < 16; ++i)
	{
		int kr1 = 2 * i;
		int kr2 = kr1 + 1;
		k1[i] = kr1;
		k2[i] = kr2;
	}

	int firstFree = 16;
	int k = 1;
	for (int i = 1; i < 31; ++i)
	{
		long long s = 1 << (i - 1);
		if ((n & s) > 0)
		{
			if (k == 1)
			{
				k1[firstFree] = map[i];
				k++;
			}
			else
			{
				k2[firstFree] = map[i];
				firstFree++;
				k = 1;
			}			
		}
	}



	printf("100\n");
	for (int i = 1; i < 101; ++i)
	{
		printf("%d %d\n", k1[i], k2[i]);
	}
}