#include <bits/stdc++.h>
using namespace std;
const int MOD = 100000007;
const int MAXN = 1000000;
const int inf = 0x3f3f3f3f;
int book[200005], a[200005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    book[a[i]]++;
  }
  int Max = 0, shu, pos, ans;
  for (int i = 0; i < 200005; i++) {
    if (Max < book[i]) {
      Max = book[i];
      shu = i;
      ans = n - book[i];
    }
  }
  printf("%d\n", ans);
  for (int i = 0; i < n; i++) {
    if (a[i] == shu) pos = i;
  }
  int t = pos;
  while (t--) {
    if (a[t] == shu) continue;
    if (a[t] > shu) {
      printf("2 %d %d\n", t + 1, t + 2);
    }
    if (a[t] < shu) {
      printf("1 %d %d\n", t + 1, t + 2);
    }
  }
  for (int i = pos; i < n; i++) {
    if (a[i] == shu) continue;
    if (a[i] > shu) {
      printf("2 %d %d\n", i + 1, i);
    }
    if (a[i] < shu) {
      printf("1 %d %d\n", i + 1, i);
    }
  }
  return 0;
}
