#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n + 1];
  unordered_map<int, int> m;
  int max = 0;
  int index;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    m[a[i]] += 1;
    if (m[a[i]] > max) {
      max = m[a[i]];
      index = i;
    }
  }
  int val = a[index];
  cout << (n - max) << endl;
  for (int i = index - 1; i > 0; i--) {
    if (a[i] != val) {
      if (val > a[i])
        cout << "1 " << i << " " << i + 1 << endl;
      else
        cout << "2 " << i << " " << i + 1 << endl;
    }
  }
  for (int i = index + 1; i <= n; i++) {
    if (val != a[i]) {
      if (val > a[i])
        cout << "1 " << i << " " << i - 1 << endl;
      else
        cout << "2 " << i << " " << i - 1 << endl;
    }
  }
}
