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
#include <bits/stdc++.h>
#define PB push_back
#define ST first
#define ND second
#define _ ios_base::sync_with_stdio(0); cin.tie(0);
//mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());

using namespace std;

using ll = long long;
using pi = pair<int,int>;
using vi = vector<int>;

int k;
vi rem;
vector<pi>ans;
int last = 1;

int main() {_
	cin >> k;
	if(k == 1) {
		cout << "2\n2 -1\n-1 -1";
		return 0;
	} else if(k == 2) {
		cout << "4\n2 3\n4 -1\n4 -1\n-1 -1";
		return 0;
	} else if(k == 3) {
		cout << "5\n2 3\n4 5\n5 -1\n5 -1\n-1 -1";
		return 0;
	}
	rem.PB(k);
	while(k > 1) {
		k /= 2;
		rem.PB(k);
	}
	reverse(rem.begin(), rem.end());
	ans.PB({2, 31});
	for(int i = 1; i < 29; ++i) {
		ans.PB({i + 2, -1});
	}
	ans.PB({-1, -1});
	ans.PB({32,33});
	last = 32;
	int add = 2;
	for(int i = 0; i < (int)rem.size() - 1; ++i) {
		int x = last;
		if(i == (int)rem.size() - 2) {
			ans.PB({x + 2, -1});
			ans.PB({x + 2, -1});
			ans.PB({-1, -1});
		} else {
			ans.PB({x + 2, x + 3});
			ans.PB({x + 2, x + 3});
		}
		if(rem[i + 1] & 1) {
			ans[add - 1].ND = x;
			add++;
		}
		last += 2;
	}
	cout << (int)ans.size() << "\n";
	for(auto it : ans) {
		cout << it.ST << " " << it.ND << "\n";
	}
	
			
		
	
		
	
}