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
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <climits>
using namespace std;
void input(int &k) {
  cin >> k;
}
void solve(int &k) {
  vector<vector<int>> G(100);
  vector<int> where(100);
  int id = 1;
  for (int power = 0; pow(2, power) <= k; power++) {
    G[id] = {id + 1, id + 2};
    G[id + 1] = {id + 2};
    where[power] = id + 1;
    id += 2;
  }
  id++;
  int x = 0;
  while (k > 0) {
    if (k % 2) G[where[x]].push_back(id);
    k /= 2;
    x++;
  }
  cout << id << "\n";
  for (int i = 1; i <= id; i++) {
    if (G[i].size() == 2) cout << G[i][0] << " " << G[i][1] << "\n";
    else if (G[i].size() == 1) cout << G[i][0] << " -1\n";
    else cout << "-1 -1\n";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  int k;
  input(k);
  solve(k);
  return 0;
}