#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using P = pair<int, int>;

bool mat[32][32];

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int K;
    cin >> K;
    for (int i = 0; i < 31; i++) {
        for (int j = i + 1; j < 31; j++) {
            mat[i][j] = true;
        }
    }
    for (int i = 0; i < 30; i++) {
        if (K & (1 << i)) {
            mat[i + 1][31] = true;
        }
    }

    int n = 32;
    vector<P> e;
    for (int i = 0; i < n; i++) {
        for (int j = i + 1; j < n; j++) {
            if (mat[i][j]) e.emplace_back(i + 1, j + 1);
        }
    }
    int m = e.size();
    cout << n << " " << m << endl;
    for (auto& p : e) {
        cout << p.first << " " << p.second << endl;
    }
    return 0;
}