#include <bits/stdc++.h>
using namespace std;
int n, a[200005], d[200005], m(0), id, x;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i], ++d[a[i]];
  for (int i = 1; i <= n; i++)
    if (d[a[i]] > m) m = d[a[i]], id = i, x = a[i];
  cout << n - m << "\n";
  for (int i = id - 1; i; i--) {
    if (a[i] < x)
      cout << 1 << " " << i << " " << i + 1 << "\n";
    else if (a[i] > x)
      cout << 2 << " " << i << " " << i + 1 << "\n";
  }
  for (int i = id + 1; i <= n; i++) {
    if (a[i] < x)
      cout << 1 << " " << i << " " << i - 1 << "\n";
    else if (a[i] > x)
      cout << 2 << " " << i << " " << i - 1 << "\n";
  }
  return 0;
}
