#include <bits/stdc++.h>
using namespace std;
int main() {
  int mx = 0, n, i, p, start = -1;
  cin >> n;
  vector<int> V(n);
  map<int, int> M;
  for (i = 0; i < n; i++) {
    cin >> V[i];
    ++M[V[i]];
  }
  if (n == 1) {
    cout << 0;
    return 0;
  }
  for (auto it : M) {
    if (mx < it.second) {
      mx = it.second;
      p = it.first;
    }
  }
  cout << n - mx << endl;
  if (n - mx == 0) return 0;
  if (mx == 1) p = V[1];
  queue<int> Z;
  set<int> S;
  for (i = 0; i < n; i++) {
    while (i < n && V[i] == p) ++i;
    if (i && V[i - 1] == p) {
      if (!S.count(i)) {
        S.insert(i);
        --i;
        Z.push(i);
      }
    }
  }
  i = 0;
  while (i < n) {
    if (V[i] == p && start == -1) start = i;
    if (i == Z.front()) {
      Z.pop();
      while (i < n - 1 && (Z.empty() || (Z.size() && i + 1 != Z.front()))) {
        if (V[i + 1] == p) break;
        V[i] < V[i + 1] ? cout << 2 << " " << i + 2 << " " << i + 1 << endl
                        : cout << 1 << " " << i + 2 << " " << i + 1 << endl;
        V[i + 1] = V[i];
        ++i;
      }
    } else
      ++i;
  }
  if (!start) return 0;
  while (start) {
    V[start - 1] > p ? cout << 2 << " " << start << " " << start + 1 << endl
                     : cout << 1 << " " << start << " " << start + 1 << endl;
    --start;
  }
}
