#include <bits/stdc++.h>
using namespace std;
void convert(int x, int i, int j, int maxval) {
  if (x < maxval) {
    cout << 1 << " " << i + 1 << " " << j + 1 << '\n';
  } else if (x > maxval) {
    cout << 2 << " " << i + 1 << " " << j + 1 << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int arr[n], occ[200005];
  memset(occ, 0, sizeof(occ));
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    occ[arr[i]]++;
  }
  int maxval, maxocc = -1;
  for (int i = 0; i < 200005; i++) {
    if (occ[i] > maxocc) {
      maxval = i;
      maxocc = occ[i];
    }
  }
  int cnt = 0, sting;
  for (int i = 0; i < n; i++) {
    if (arr[i] == maxval) {
      sting = i;
    } else
      cnt++;
  }
  cout << cnt << '\n';
  int lp = sting - 1, rp = sting + 1;
  while (lp >= 0) {
    convert(arr[lp], lp, lp + 1, maxval);
    lp--;
  }
  while (rp < n) {
    convert(arr[rp], rp, rp - 1, maxval);
    rp++;
  }
  return 0;
}
