#include <bits/stdc++.h>
using namespace std;
long long int sortbyfirst(const pair<long long int, string>& a,
                          const pair<long long int, string>& b) {
  return (a.first > b.first);
}
long long int fact(long long int n) {
  if (n > 1)
    return n * fact(n - 1);
  else
    return 1;
}
long long int gcd(long long int a, long long int b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ;
  long long int i, j, x, n, a, val;
  cin >> n;
  vector<long long int> v;
  long long int cnt[200000 + 10] = {};
  long long int mx = -1, mxx = 0;
  for (long long int i = 0; i < n; i++) {
    cin >> x;
    v.push_back(x);
    cnt[x]++;
    a = cnt[x];
    if (a > mx) {
      mx = max(mx, a);
      val = x;
    }
  }
  long long int ind = find(v.begin(), v.end(), val) - v.begin();
  cout << n - mx << '\n';
  for (long long int i = ind - 1; i >= 0; i--) {
    if (v[i] < v[ind]) {
      cout << "1 " << i + 1 << " " << i + 1 + 1 << '\n';
    } else if (v[i] > v[ind]) {
      cout << "2 " << i + 1 << " " << i + 1 + 1 << '\n';
    }
  }
  for (long long int i = ind + 1; i < n; i++) {
    if (v[i] > v[ind]) {
      cout << "2 " << i + 1 << " " << i << '\n';
    } else if (v[i] < v[ind]) {
      cout << "1 " << i + 1 << " " << i << '\n';
    }
  }
  return 0;
}
