#include <bits/stdc++.h>
using namespace std;
int a[210000];
int op[2100000], pos1[2100000], pos2[2100000];
int cnt;
int main() {
  cin.sync_with_stdio(0), cin.tie(0), cout.tie(0);
  int n;
  cin >> n;
  map<int, int> f;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    f[a[i]]++;
  }
  int ma = 0;
  int num = 0;
  for (auto i : f) {
    if (i.second > ma) {
      ma = i.second;
      num = i.first;
    }
  }
  int last = n;
  for (int i = 0; i < n; ++i) {
    if (a[i] != num) continue;
    last = i;
    for (int j = i - 1; j >= 0 && a[j] != num; j--) {
      if (a[j] > num) {
        op[cnt] = 2;
        pos1[cnt] = j;
        pos2[cnt] = j + 1;
        cnt++;
      } else {
        op[cnt] = 1;
        pos1[cnt] = j;
        pos2[cnt] = j + 1;
        cnt++;
      }
    }
  }
  for (int j = last + 1; j < n; ++j) {
    if (a[j] > num) {
      op[cnt] = 2;
      pos1[cnt] = j;
      pos2[cnt] = j - 1;
      cnt++;
    } else {
      op[cnt] = 1;
      pos1[cnt] = j;
      pos2[cnt] = j - 1;
      cnt++;
    }
  }
  cout << cnt << '\n';
  for (int i = 0; i < cnt; ++i) {
    cout << op[i] << " " << pos1[i] + 1 << " " << pos2[i] + 1 << '\n';
  }
  return 0;
}
