#include <bits/stdc++.h>
using namespace std;
int n;
int info[200000];
int main() {
  cin >> n;
  map<int, int> lastIdx;
  map<int, int> cnt;
  int max = 0;
  int maxVal = 0;
  for (int i = 0; i < n; i++) {
    cin >> info[i];
    if (cnt.count(info[i]) == 0)
      cnt[info[i]] = 1;
    else
      cnt[info[i]] = cnt[info[i]] + 1;
    if (max < cnt[info[i]]) {
      max = cnt[info[i]];
      maxVal = info[i];
    }
    lastIdx[info[i]] = i;
  }
  cout << n - max << endl;
  int stop = lastIdx[maxVal];
  for (int i = stop - 1; i >= 0; i--) {
    if (info[i] == maxVal) continue;
    if (maxVal > info[i]) {
      cout << "1 " + to_string(i + 1) + " " + to_string(i + 1 + 1) << endl;
    } else if (maxVal < info[i]) {
      cout << "2 " + to_string(i + 1) + " " + to_string(i + 1 + 1) << endl;
    }
  }
  for (int i = stop; i < n; i++) {
    if (maxVal > info[i]) {
      cout << "1 " + to_string(i + 1) + " " + to_string(i - 1 + 1) << endl;
    } else if (maxVal < info[i]) {
      cout << "2 " + to_string(i + 1) + " " + to_string(i - 1 + 1) << endl;
    }
  }
}
