#include using namespace std; using ll = long long; template istream& operator >> (istream& is, vector& vec) { for(T& x : vec) is >> x; return is; } template ostream& operator << (ostream& os, const vector& vec) { if(vec.empty()) return os; os << vec[0]; for(auto it = vec.begin(); ++it != vec.end(); ) os << ' ' << *it; return os; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector a(n); for(auto &&v : a) cin >> v; auto b = a; b.erase(unique(b.begin(), b.end()), b.end()); vector> ans; while(b.size() >= 2){ int mid = b.size() / 2; ll th = b[mid]; ll v = th - b[0]; ans.emplace_back(1, 0, v); for(int i = 0; i < n; i++){ if(a[i] < th){ a[i] += v; get<1>(ans.back()) = i + 1; } } sort(a.begin(), a.end()); b = a; b.erase(unique(b.begin(), b.end()), b.end()); } for(auto [l, r, v] : ans) cout << l << " " << r << " " << v << '\n'; }