#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long a[n];
  map<long long, long long> mp;
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
    mp[a[i]]++;
  }
  map<long long, long long>::iterator it;
  long long max = 0, value;
  for (it = mp.begin(); it != mp.end(); it++) {
    if (max < it->second) {
      max = it->second;
      value = it->first;
    }
  }
  long long index;
  for (long long i = 0; i < n; i++) {
    if (a[i] == value) {
      index = i;
      break;
    }
  }
  long long cnt = 0;
  vector<long long> v1, v2, v3;
  for (long long i = index; i < n - 1; i++) {
    if (a[i] > a[i + 1]) {
      a[i + 1] = a[i + 1] + abs(a[i] - a[i + 1]);
      cnt++;
      v1.push_back(1);
      v2.push_back(i + 2);
      v3.push_back(i + 1);
    } else if (a[i + 1] > a[i]) {
      a[i + 1] = a[i + 1] - abs(a[i] - a[i + 1]);
      cnt++;
      v1.push_back(2);
      v2.push_back(i + 2);
      v3.push_back(i + 1);
    }
  }
  for (long long i = index; i >= 1; i--) {
    if (a[i] > a[i - 1]) {
      a[i - 1] = a[i - 1] + abs(a[i] - a[i - 1]);
      cnt++;
      v1.push_back(1);
      v2.push_back(i);
      v3.push_back(i + 1);
    } else if (a[i] < a[i - 1]) {
      a[i - 1] = a[i - 1] - abs(a[i] - a[i - 1]);
      cnt++;
      v1.push_back(2);
      v2.push_back(i);
      v3.push_back(i + 1);
    }
  }
  cout << cnt << endl;
  for (long long i = 0; i < cnt; i++) {
    cout << v1[i] << " " << v2[i] << " " << v3[i] << endl;
  }
}
