#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long int n;
  cin >> n;
  long long int a[n];
  map<long long int, long long int> ma;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    ma[a[i]]++;
  }
  long long int max = 0, ele = 0;
  for (auto it = ma.begin(); it != ma.end(); it++) {
    if (it->second > max) {
      max = it->second;
      ele = it->first;
    }
  }
  long long int index = 0;
  vector<pair<long long int, pair<long long int, long long int>>> v;
  for (int i = 0; i < n; i++) {
    if (a[i] == ele) {
      index = i;
    }
  }
  for (int j = index - 1; j >= 0; j--) {
    if (a[j] < a[index]) {
      v.push_back(make_pair(1, make_pair(j + 1, j + 1 + 1)));
    } else if (a[j] > a[index]) {
      v.push_back(make_pair(2, make_pair(j + 1, j + 1 + 1)));
    }
  }
  for (int i = index + 1; i < n; i++) {
    if (a[i] < a[index]) {
      v.push_back(make_pair(1, make_pair(i + 1, i - 1 + 1)));
    } else if (a[i] > a[index]) {
      v.push_back(make_pair(2, make_pair(i + 1, i + 1 - 1)));
    }
  }
  cout << n - max << endl;
  for (int i = 0; i < v.size(); i++) {
    cout << v[i].first << " " << v[i].second.first << " " << v[i].second.second
         << endl;
  }
}
