#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, max, j;
  cin >> n;
  int a[n];
  int freq[200000] = {0};
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    freq[a[i]] += 1;
  }
  max = 0;
  for (int i = 0; i < 200000; i++) {
    if (freq[i] > max) {
      max = freq[i];
      j = i;
    }
  }
  cout << n - max << "\n";
  max = j;
  for (int i = 0; i < n; i++) {
    if (a[i] == j) {
      j = i;
      break;
    }
  }
  for (int i = j; i >= 0; i--) {
    if (a[i] != max) {
      if (a[i] < a[i + 1]) {
        cout << 1 << " " << i + 1 << " " << i + 2 << "\n";
      } else {
        cout << 2 << " " << i + 1 << " " << i + 2 << "\n";
      }
      a[i] = max;
    }
  }
  for (int i = j; i < n - 1; i++) {
    if (a[i + 1] != max) {
      if (a[i + 1] < a[i]) {
        cout << 1 << " " << i + 2 << " " << i + 1 << "\n";
      } else {
        cout << 2 << " " << i + 2 << " " << i + 1 << "\n";
      }
      a[i + 1] = max;
    }
  }
  return 0;
}
