#include <bits/stdc++.h>
using namespace std;
const int INF = 2e6;
const long long LINF = 8e18;
const int MOD = 1e9 + 7;
const long double EPS = 1e-9;
int n;
vector<long long> a;
struct triplet {
  int ti, i, j;
};
vector<struct triplet> s;
int cnt[INF];
int main() {
  scanf("%d", &n);
  ;
  if (n == 1) {
    printf("0");
    return 0;
  }
  for (int i = 0; i < INF; i++) cnt[i] = 0;
  for (int i = 0; i < n; i++) {
    long long X;
    scanf("%lld", &X);
    a.push_back(X);
    cnt[X]++;
  }
  int mx = -1, mx_i = 0;
  for (int i = 0; i < n; i++) mx = max(mx, cnt[a[i]]);
  for (int i = 0; i < n; i++)
    if (mx == cnt[a[i]]) mx_i = i;
  for (int i = mx_i + 1; i < n; i++) {
    if (a[i] < a[mx_i]) s.push_back({1, i, i - 1});
    if (a[i] > a[mx_i]) s.push_back({2, i, i - 1});
  }
  for (int i = mx_i - 1; i > -1; i = i - 1) {
    if (a[i] < a[mx_i]) s.push_back({1, i, i + 1});
    if (a[i] > a[mx_i]) s.push_back({2, i, i + 1});
  }
  printf("%ld", s.size());
  for (struct triplet it : s) {
    printf("\n");
    printf("%d %d %d", it.ti, it.i + 1, it.j + 1);
  }
  return 0;
}
