#include <bits/stdc++.h>
using namespace std;
using u128 = __uint128_t;
signed main() {
  long long t = 1;
  while (t--) {
    long long n;
    cin >> n;
    vector<long long> a(n);
    map<long long, long long> mp;
    for (long long i = 0; i < n; i++) cin >> a[i], mp[a[i]]++;
    long long mx = -1, mct = 0;
    for (auto i : mp) {
      if (i.second > mct) {
        mct = i.second;
        mx = i.first;
      }
    }
    vector<long long> ind;
    for (long long i = 0; i < n; i++) {
      if (a[i] == mx) {
        ind.push_back(i);
      }
    }
    cout << n - ind.size() << "\n";
    for (long long i = ind[0] - 1; i >= 0; i--) {
      if (a[i] < mx) {
        cout << 1 << " " << i + 1 << " " << i + 2 << "\n";
      } else {
        cout << 2 << " " << i + 1 << " " << i + 2 << "\n";
      }
      a[i] = mx;
    }
    for (long long i = 0; i < n - 1; i++) {
      if (a[i + 1] != mx) {
        if (a[i + 1] < a[i]) {
          cout << 1 << " " << i + 2 << " " << i + 1 << "\n";
        } else {
          cout << 2 << " " << i + 2 << " " << i + 1 << "\n";
        }
      }
      a[i + 1] = mx;
    }
  }
  return 0;
}
