#include using namespace std; #ifdef LOCAL #include "settings/debug.cpp" #else #define Debug(...) void(0) #endif #define rep(i, n) for (int i = 0; i < (n); ++i) using ll = long long; using ull = unsigned long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); int n; cin >> n; vector a(n); rep(i, n) cin >> a[i]; a.push_back((1 << 30) - 1); // 番兵 vector> ans; for (int b = 29; b >= 0; --b) { sort(a.begin(), a.end()); for (int i = 0; i <= n; ++i) { if (a[i] & (1 << b)) { if (i != 0) { ans.push_back({ 1, i, 1 << b }); for (int j = 0; j < i; ++j) a[j] += (1 << b); } break; } } rep(i, n) assert(a[i] & (1 << b)); } sort(a.begin(), a.end()); assert(a.front() == a.back()); cout << ans.size() << '\n'; for (auto [x, y, z] : ans) cout << x << ' ' << y << ' ' << z << '\n'; return 0; }