#include <bits/stdc++.h>
const int oo = 0x3f3f3f3f, mod = 1e9 + 7;
using namespace std;
int dx[]{1, -1, 0, 0, 1, 1, -1, -1};
int dy[]{0, 0, 1, -1, 1, -1, 1, -1};
long long OO = (1LL * oo * oo);
void K_K() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  K_K();
  long long n, mx = 0, mxidx = 0;
  cin >> n;
  map<long long, long long> mp;
  vector<long long> v(n + 2);
  vector<pair<long long, pair<long long, long long>>> ans;
  for (int i = 1; i <= n; i++) {
    cin >> v[i], mp[v[i]]++;
    if (mp[v[i]] > mx) mxidx = i, mx = mp[v[i]];
  }
  for (int i = mxidx - 1; i > 0; i--) {
    if (v[i] > v[i + 1]) {
      v[i] -= abs(v[i] - v[i + 1]);
      ans.push_back({2, {i, i + 1}});
    } else if (v[i] < v[i + 1]) {
      ans.push_back({1, {i, i + 1}});
      v[i] += abs(v[i] - v[i + 1]);
    }
  }
  for (int i = mxidx + 1; i <= n; i++) {
    if (v[i] > v[i - 1]) {
      v[i] -= abs(v[i] - v[i - 1]);
      ans.push_back({2, {i, i - 1}});
    } else if (v[i] < v[i - 1]) {
      ans.push_back({1, {i, i - 1}});
      v[i] += abs(v[i] - v[i - 1]);
    }
  }
  cout << (int)(ans.size()) << "\n";
  for (int i = 0; i < (int)(ans.size()); i++)
    cout << ans[i].first << " " << ans[i].second.first << " "
         << ans[i].second.second << "\n";
}
