#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool read(T &x) {
  int c = getchar();
  int sgn = 1;
  while (~c && c<'0' | c> '9') {
    if (c == '-') sgn = -1;
    c = getchar();
  }
  for (x = 0; ~c && '0' <= c && c <= '9'; c = getchar()) x = x * 10 + c - '0';
  x *= sgn;
  return ~c;
}
const long long N = 200005;
const long long MOD = 1e9 + 7;
long long cnt[N];
long long ara[N];
int main() {
  long long n = ({
    long long a;
    read(a);
    a;
  });
  long long mx = 0;
  long long val;
  for (int i = 1; i <= n; i++) {
    ara[i] = ({
      long long a;
      read(a);
      a;
    });
    ++cnt[ara[i]];
    if (cnt[ara[i]] > mx) {
      mx = cnt[ara[i]];
      val = ara[i];
    }
  }
  if (mx == n)
    puts("0");
  else {
    cout << n - mx << endl;
    for (int i = 1; i <= n; i++) {
      if (ara[i] == val) {
        for (long long j = i - 1; j >= 1; --j) {
          if (ara[j] != val) {
            if (ara[j] > val) {
              cout << 2 << ' ' << j << ' ' << j + 1 << endl;
            } else {
              cout << 1 << ' ' << j << ' ' << j + 1 << endl;
            }
            ara[j] = val;
          } else
            break;
        }
        for (long long j = i + 1; j <= n; ++j) {
          if (ara[j] != val) {
            if (ara[j] > val) {
              cout << 2 << ' ' << j << ' ' << j - 1 << endl;
            } else {
              cout << 1 << ' ' << j << ' ' << j - 1 << endl;
            }
            ara[j] = val;
          } else
            break;
        }
      }
    }
  }
}
