#include <bits/stdc++.h>
using namespace std;
vector<int> a;
vector<pair<int, pair<int, int>>> d;
map<int, int> q;
int main() {
  int n;
  cin >> n;
  int mxa = 0, mxn = -1;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    a.push_back(x);
    q[x]++;
    if (q[x] >= mxa) {
      mxa = q[x];
      mxn = x;
    }
    if (q[x] == n) return cout << 0 << endl, 0;
  }
  int pos = -1;
  for (int i = 0; i < n; i++) {
    if (mxn == a[i]) {
      pos = i;
      break;
    }
  }
  int i = pos - 1, j = pos + 1;
  while (j != n || i != -1) {
    if (i != -1) {
      if (a[i] < a[pos]) d.push_back({1, {i + 1, i + 2}});
      if (a[i] > a[pos]) d.push_back({2, {i + 1, i + 2}});
      i--;
    }
    if (j != n) {
      if (a[j] < a[pos]) d.push_back({1, {j + 1, j}});
      if (a[j] > a[pos]) d.push_back({2, {j + 1, j}});
      j++;
    }
  }
  cout << d.size() << endl;
  for (int i = 0; i < d.size(); i++)
    cout << d[i].first << " " << d[i].second.first << " " << d[i].second.second
         << endl;
}
