#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int arr[2 * 100107 + 10];
int cnt[2 * 100107 + 10];
struct data {
  int tp, ip, jp;
};
int32_t main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    cnt[arr[i]]++;
  }
  int mx_cnt = 0;
  int mx_number = -1;
  for (int i = 0; i < 2 * 100107; i++) {
    if (cnt[i] > mx_cnt) {
      mx_cnt = cnt[i];
      mx_number = i;
    }
  }
  vector<data> v;
  int i = 0, j = 0;
  while (i < n) {
    if (arr[i] == mx_number) {
      j = i + 1;
      while (j < n && arr[j] != mx_number) {
        data d;
        if (arr[j] < mx_number) {
          arr[j] = arr[j] + abs(arr[j] - mx_number);
          d.tp = 1;
          d.ip = j + 1;
          d.jp = j;
          v.push_back(d);
        } else {
          d.tp = 2;
          d.ip = j + 1;
          d.jp = j;
          v.push_back(d);
          arr[j] = arr[j] - abs(arr[j] - mx_number);
        }
        j++;
      }
      j = i - 1;
      while (j >= 0 && arr[j] != mx_number) {
        data d;
        if (arr[j] < mx_number) {
          d.tp = 1;
          d.ip = j + 1;
          d.jp = j + 2;
          v.push_back(d);
          arr[j] = arr[j] + abs(arr[j] - mx_number);
        } else {
          d.tp = 2;
          d.ip = j + 1;
          d.jp = j + 2;
          v.push_back(d);
          arr[j] = arr[j] - abs(arr[j] - mx_number);
        }
        j--;
      }
    }
    i++;
  }
  cout << v.size() << endl;
  for (int i = 0; i < v.size(); i++) {
    cout << v[i].tp << " " << v[i].ip << " " << v[i].jp << endl;
  }
}
