#include <bits/stdc++.h>
using namespace std;
const int maxn = 200000 + 5;
struct p {
  int t, pos1, pos2;
} f;
int main() {
  int n;
  scanf("%d", &n);
  int vis[maxn] = {0}, a[maxn], ma = 0;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    vis[a[i]]++;
    if (vis[a[i]] > vis[a[ma]]) ma = i;
  }
  if (vis[a[ma]] == n)
    puts("0");
  else {
    queue<p> q;
    for (int i = ma; i > 1; i--)
      if (a[i - 1] < a[ma]) {
        f.t = 1, f.pos1 = i - 1, f.pos2 = i;
        q.push(f);
      } else if (a[i - 1] > a[ma]) {
        f.t = 2, f.pos1 = i - 1, f.pos2 = i;
        q.push(f);
      }
    for (int i = ma + 1; i <= n; i++)
      if (a[i] < a[ma]) {
        f.t = 1, f.pos1 = i, f.pos2 = i - 1;
        q.push(f);
      } else if (a[i] > a[ma]) {
        f.t = 2, f.pos1 = i, f.pos2 = i - 1;
        q.push(f);
      }
    printf("%d\n", q.size());
    while (!q.empty()) {
      f = q.front();
      q.pop();
      printf("%d %d %d", f.t, f.pos1, f.pos2);
      cout << endl;
    }
  }
  return 0;
}
