#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k, cnt = 0, nm, ind;
  cin >> n;
  map<int, int> mp;
  vector<pair<int, pair<int, int> > > first;
  vector<pair<int, pair<int, int> > >::iterator it;
  vector<int> v;
  for (int i = 0; i < n; i++) {
    cin >> k;
    v.push_back(k);
    mp[k]++;
    if (mp[k] > cnt) {
      cnt = mp[k];
      nm = k;
    }
    if (v[i] == nm) {
      ind = i;
    }
  }
  for (int i = ind - 1; i >= 0; i--) {
    if (v[i] != nm) {
      if (v[i] < nm) {
        first.push_back(make_pair(1, make_pair(i + 1, i + 2)));
      } else if (v[i] > nm) {
        first.push_back(make_pair(2, make_pair(i + 1, i + 2)));
      }
    }
  }
  for (int i = ind + 1; i < n; i++) {
    if (v[i] != nm) {
      if (v[i] < nm) {
        first.push_back(make_pair(1, make_pair(i + 1, i)));
      } else if (v[i] > nm) {
        first.push_back(make_pair(2, make_pair(i + 1, i)));
      }
    }
  }
  cout << n - cnt << endl;
  for (it = first.begin(); it != first.end(); it++) {
    cout << it->first << " " << it->second.first << " " << it->second.second
         << endl;
  }
}
