#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n;
  cin >> n;
  long long int a[n];
  map<long long int, long long int> m;
  long long int flag = 1, l;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  map<long long int, long long int>::iterator it = m.begin();
  long long int s = -1, p = -1;
  for (it; it != m.end(); it++) {
    if (it->second > s) {
      s = it->second;
      p = it->first;
    }
  }
  vector<long long int> vp;
  for (long long i = 0; i < n; i++) {
    if (a[i] == p) vp.push_back(i);
  }
  vector<long long int> v1, v2, v3;
  for (long long int i = vp[0] - 1; i >= 0; i--) {
    if (a[i] < p) {
      v1.push_back(1);
      v2.push_back(i);
      v3.push_back(i + 1);
    } else if (a[i] > p) {
      v1.push_back(2);
      v2.push_back(i);
      v3.push_back(i + 1);
    }
  }
  for (long long int i = vp[0] + 1; i < n; i++) {
    if (a[i] < p) {
      v1.push_back(1);
      v2.push_back(i);
      v3.push_back(i - 1);
    } else if (a[i] > p) {
      v1.push_back(2);
      v2.push_back(i);
      v3.push_back(i - 1);
    }
  }
  cout << v1.size() << '\n';
  for (long long i = 0; i < v1.size(); i++) {
    cout << v1[i] << " " << v2[i] + 1 << " " << v3[i] + 1 << '\n';
  }
  return 0;
}
