#include <bits/stdc++.h>
using namespace std;
struct store {
  int i, j, k;
};
int main() {
  int n;
  cin >> n;
  int arr[n];
  map<int, int> m;
  int maxcount = 0;
  int first;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    m[arr[i]]++;
    if (m[arr[i]] > maxcount) {
      first = arr[i];
      maxcount = m[arr[i]];
    }
  }
  int k;
  for (int i = 0; i < n; i++) {
    if (arr[i] == first) {
      k = i;
    }
  }
  vector<store> Store;
  int cc = 0;
  for (int i = k; i >= 0; i--) {
    if (arr[i] == first) continue;
    store temp;
    cc++;
    if (arr[i] > first)
      temp.i = 2;
    else
      temp.i = 1;
    temp.j = i;
    temp.k = i + 1;
    Store.push_back(temp);
  }
  for (int i = k; i < n; i++) {
    if (arr[i] == first) continue;
    store temp;
    cc++;
    if (arr[i] > first)
      temp.i = 2;
    else
      temp.i = 1;
    temp.j = i;
    temp.k = i - 1;
    Store.push_back(temp);
  }
  cout << cc << endl;
  for (int i = 0; i < Store.size(); i++) {
    cout << Store[i].i << " " << Store[i].j + 1 << " " << Store[i].k + 1
         << endl;
  }
  return 0;
}
