#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 1;
int n, a[N], cnt[N], mx;
vector<pair<int, pair<int, int> > > ans;
int main() {
  ios_base ::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    ++cnt[a[i]];
    mx = max(mx, cnt[a[i]]);
  }
  int pos, x;
  for (int i = 1; i <= n; ++i) {
    if (cnt[a[i]] == mx) {
      x = a[i];
      pos = i;
      break;
    }
  }
  for (int i = pos - 1; i >= 1; --i) {
    if (x != a[i]) {
      if (x < a[i]) {
        ans.push_back({2, {i, i + 1}});
      } else {
        ans.push_back({1, {i, i + 1}});
      }
    }
  }
  for (int i = pos + 1; i <= n; ++i) {
    if (x != a[i]) {
      if (x < a[i]) {
        ans.push_back({2, {i, i - 1}});
      } else {
        ans.push_back({1, {i, i - 1}});
      }
    }
  }
  cout << (int)ans.size() << '\n';
  for (auto it : ans) {
    cout << it.first << " " << it.second.first << " " << it.second.second
         << "\n";
  }
  return 0;
}
