#include <bits/stdc++.h>
using namespace std;
vector<int> todelete;
int arrc[100005];
int prodfs(vector<int> v[], int i) {
  if (v[i].size() == 0) {
    if (arrc[i] == 1) {
      todelete.push_back(i);
      return 1;
    }
    return 0;
  }
  int ans = 1;
  for (int j = 0; j < v[i].size(); j++) {
    ans = prodfs(v, v[i][j]) * ans;
  }
  if (arrc[i] == 1 && ans == 1) {
    todelete.push_back(i);
  }
  return arrc[i];
}
vector<int> v;
int main() {
  ios::sync_with_stdio(false);
  long long int i, j, k, q, t, tmp, n, flg = 0, cntr = 0, maxxer = 0;
  cin >> n;
  int a[n + 1];
  map<int, int> m;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]]++;
  }
  int mx = 0, pos = 0;
  int ele;
  for (auto it = m.begin(); it != m.end(); it++) {
    if (it->second > mx) {
      ele = it->first;
      mx = it->second;
    }
  }
  i = 0;
  while (i < n) {
    if (a[i] == ele) {
      pos = i;
      break;
    }
    i++;
  }
  i = pos - 1;
  vector<pair<int, int>> v;
  vector<pair<int, int>> v2;
  while (i >= 0) {
    if (a[i] < ele) {
      v.push_back(make_pair(1, i + 1));
    } else if (a[i] > ele) {
      v.push_back(make_pair(2, i + 1));
    }
    i--;
  }
  i = pos + 1;
  while (i < n) {
    if (a[i] < ele) {
      v2.push_back(make_pair(1, i));
    } else if (a[i] > ele) {
      v2.push_back(make_pair(2, i));
    }
    i++;
  }
  cout << v.size() + v2.size() << endl;
  for (i = 0; i < v.size(); i++) {
    cout << v[i].first << " " << v[i].second << " " << v[i].second + 1 << endl;
  }
  for (i = 0; i < v2.size(); i++) {
    cout << v2[i].first << " " << v2[i].second + 1 << " " << v2[i].second
         << endl;
  }
  return 0;
}
