#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> a(n);
  map<int, int> mp;
  int ma = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mp[a[i]]++;
    ma = max(ma, mp[a[i]]);
  }
  int t;
  for (int i = 0; i < n; i++) {
    if (mp[a[i]] == ma) {
      t = i;
      break;
    }
  }
  cout << n - ma << endl;
  for (int i = t; i < n; i++) {
    if (a[i] == a[t]) continue;
    if (a[i] < a[i - 1]) {
      cout << 1 << " " << i + 1 << " " << i << endl;
    } else {
      cout << 2 << " " << i + 1 << " " << i << endl;
    }
    a[i] = a[i - 1];
  }
  for (int i = t; i >= 0; i--) {
    if (a[i] == a[t]) continue;
    if (a[i] < a[i + 1]) {
      cout << 1 << " " << i + 1 << " " << i + 2 << endl;
    } else {
      cout << 2 << " " << i + 1 << " " << i + 2 << endl;
    }
    a[i] = a[i + 1];
  }
}
