#include <bits/stdc++.h>
using namespace std;
signed main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<int> cnt(200002, 0);
  for (int i = 0; i < n; i++) {
    cnt[a[i]]++;
  }
  int mx = 0;
  int res = 0;
  for (int i = 0; i < 200002; i++) {
    if (cnt[i] > mx) {
      mx = cnt[i];
      res = i;
    }
  }
  int ind = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == res) {
      ind = i;
      break;
    }
  }
  cout << n - mx << '\n';
  int ind1 = ind;
  while (ind1 > 0) {
    if (a[ind1 - 1] < res) {
      cout << "1 " << ind1 << ' ' << ind1 + 1 << '\n';
    }
    if (a[ind1 - 1] > res) {
      cout << "2 " << ind1 << ' ' << ind1 + 1 << '\n';
    }
    ind1--;
  }
  ind1 = ind;
  while (ind1 < n - 1) {
    if (a[ind1 + 1] < res) {
      cout << "1 " << ind1 + 2 << ' ' << ind1 + 1 << '\n';
    }
    if (a[ind1 + 1] > res) {
      cout << "2 " << ind1 + 2 << ' ' << ind1 + 1 << '\n';
    }
    ind1++;
  }
  return 0;
}
