#include <bits/stdc++.h>
using namespace std;
static const int maxn = 200010;
static const int INF = 0x3f3f3f3f;
static const int mod = (int)1e9 + 7;
static const double eps = 1e-6;
static const double pi = acos(-1);
void redirect() {}
struct node {
  int x, y, z;
  node(int a, int b, int c) { x = a, y = b, z = c; }
  node() {}
};
vector<node> v;
int a[maxn], cnt[maxn];
int main() {
  redirect();
  int n, tmp = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    cnt[a[i]]++;
  }
  int maxcnt = 0, id;
  for (int i = 0; i < maxn; i++)
    if (cnt[i] > maxcnt) maxcnt = cnt[i], id = i;
  int pos = 1;
  while (a[pos] != id) pos++;
  for (int i = pos - 1; i > 0; i--) {
    tmp++;
    v.push_back(node(a[i] < id ? 1 : 2, i, i + 1));
  }
  for (int i = pos + 1; i <= n; i++) {
    if (a[i] == id) continue;
    tmp++;
    v.push_back(node(a[i] < id ? 1 : 2, i, i - 1));
  }
  printf("%d\n", tmp);
  for (auto& x : v) printf("%d %d %d\n", x.x, x.y, x.z);
  return 0;
}
