#include using namespace std; using ll = long long; bool chmin(auto &a, auto b) { return a > b ? a = b, true : false; } bool chmax(auto &a, auto b) { return a < b ? a = b, true : false; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N; cin >> N; vector cnt(30); for (int i = 0; i < N; i++) { int A; cin >> A; for (int j = 0; j < 30; j++) { cnt[j] += A >> j & 1; } } int ans = 0; for (auto e : cnt) ans += e > 0; cout << ans << '\n'; for (int j = 29; j >= 0; j--) { if (cnt[j] > 0) { cout << 1 << ' ' << cnt[j] << ' ' << (1 << j) << '\n'; } } }