#include <bits/stdc++.h>
#define pb push_back
#define REP(i, n) for (signed long long i = 0; i < (n); i++)
#define MOD 998244353
#define INF 98765431219876543
#define bitcnt(a) (ll) __builtin_popcount((a))
#define lb(a, b) lower_bound((a).begin(), (a).end(), (b))
#define ub(a, b) upper_bound((a).begin(), (a).end(), (b))
using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;

int main() {
  ll l, bs;
  cin >> l;
  vector<string> v;
  REP(i, 21) {
    if (pow(2, i) > l) {
      bs = i;
      break;
    }
  }
  cout << bs;
  REP(i, bs - 1) {
    v.pb(to_string((i + 1)) + " " + to_string((i + 2)) + " " + to_string(int(pow(2, bs - 2 - i))));

    v.pb(to_string((i + 1)) + " " + to_string((i + 2)) + " " + to_string(0));
  }
  int x = 1 << (bs - 1);
  for (int i = bs - 2; i >= 0; i--) {
    if ((l >> i) & 1) {
      v.pb(to_string(1) + " " + to_string(bs - i) + " " + to_string(x));
      x += 1 << i;
    }
  }
  cout << " " << v.size() << endl;

  for (auto &a : v) {
    cout << a << endl;
  }
}