#include <bits/stdc++.h>
using namespace std;
int a[200005];
map<int, int> m;
int main() {
  int n, c = 0, mx = 1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  int num = a[0];
  for (auto x : m) {
    if (mx < x.second) {
      mx = x.second;
      num = x.first;
    }
  }
  cout << n - mx << '\n';
  int ind;
  for (int i = 0; i < n; i++) {
    if (a[i] == num) {
      ind = i;
      break;
    }
  }
  for (int i = ind - 1; i >= 0; i--) {
    if (a[i] > a[i + 1]) {
      cout << "2 " << i + 1 << " " << i + 2 << '\n';
    } else {
      cout << "1 " << i + 1 << " " << i + 2 << '\n';
    }
    a[i] = a[i + 1];
  }
  for (int i = ind + 1; i < n; i++) {
    if (a[i] > a[i - 1]) {
      cout << "2 " << i + 1 << " " << i << '\n';
    } else if (a[i] < a[i - 1]) {
      cout << "1 " << i + 1 << " " << i << '\n';
    }
    a[i] = a[i - 1];
  }
}
