#include <bits/stdc++.h>
using namespace std;
const int mx = (2 * 1e5) + 5;
int vis[mx];
int main() {
  int i, total;
  cin >> total;
  int a[total];
  for (i = 0; i < total; i++) {
    cin >> a[i];
    vis[a[i]]++;
  }
  int maxx = 0, num;
  for (i = 0; i < mx; i++) {
    if (maxx < vis[i]) {
      maxx = vis[i];
      num = i;
    }
  }
  int pos = 0;
  for (i = 0; i < total; i++) {
    if (a[i] == num) {
      pos = i;
      break;
    }
  }
  int t = total - maxx;
  printf("%d\n", t);
  for (i = pos + 1; i < total; i++) {
    if (a[i] == num) continue;
    if (a[i - 1] < a[i])
      printf("%d %d %d\n", 2, i + 1, (i - 1) + 1);
    else
      printf("%d %d %d\n", 1, i + 1, (i - 1) + 1);
    a[i] = num;
  }
  for (i = pos - 1; i >= 0; i--) {
    if (a[i] == num) continue;
    if (a[i] > a[i + 1])
      printf("%d %d %d\n", 2, i + 1, i + 2);
    else
      printf("%d %d %d\n", 1, i + 1, i + 2);
    a[i] = num;
  }
  return 0;
}
