#include using namespace std; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define all(x) (x).begin(), (x).end() using ll = long long; const ll MOD = 998244353; #include using namespace atcoder; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll n;cin >> n; vector a(n); rep(i, n) cin >> a[i]; vector> ans; while (a[0]!=a[n-1]){ ll l=a[0], r=a[n-1]; ll m=(l+r)/2; auto it = upper_bound(all(a), m); rep(i,it-a.begin()) { a[i]+=r-m; } ans.push_back({0, it-a.begin(), r-m}); sort(all(a)); } cout << ans.size() << endl; for (auto& v : ans) { cout << 1 << " " << v[1] << " " << v[2] << endl; } }