#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n], b[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b, b + n);
  int ma = 0, cu = 0, nu = b[0];
  cu++;
  for (int i = 1; i < n; i++) {
    if (b[i] == b[i - 1])
      cu++;
    else {
      if (cu > ma) {
        ma = cu;
        nu = b[i - 1];
      }
      cu = 1;
    }
  }
  if (cu > ma) {
    ma = cu;
    nu = b[n - 1];
  }
  int ind = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == nu) {
      ind = i;
      break;
    }
  }
  cout << n - ma << endl;
  for (int i = ind - 1; i >= 0; i--) {
    if (a[i] > a[ind]) {
      cout << "2 " << i + 1 << " " << i + 2 << endl;
    } else if (a[i] < a[ind]) {
      cout << "1 " << i + 1 << " " << i + 2 << endl;
    }
  }
  for (int i = ind + 1; i < n; i++) {
    if (a[i] > a[ind]) {
      cout << "2 " << i + 1 << " " << i << endl;
    } else if (a[i] < a[ind]) {
      cout << "1 " << i + 1 << " " << i << endl;
    }
  }
}
