#include <bits/stdc++.h>
using namespace std;
vector<long long int> v;
map<long long int, long long int> mm;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long int n, a, mx = -1, vl, id;
  scanf("%lld", &n);
  for (long long int i = 0; i < n; i++) {
    scanf("%lld", &a);
    v.push_back(a);
    mm[a] = mm[a] + 1;
    if (mm[a] > mx) {
      mx = mm[a];
      id = i;
      vl = a;
    }
  }
  vector<tuple<long long int, long long int, long long int> > v1;
  for (long long int i = id - 1; i >= 0; i--) {
    if (v[i] != vl) {
      if (v[i] > vl) {
        tuple<long long int, long long int, long long int> tp =
            make_tuple(2, i, i + 1);
        v1.push_back(tp);
      } else {
        tuple<long long int, long long int, long long int> tp =
            make_tuple(1, i, i + 1);
        v1.push_back(tp);
      }
    }
  }
  for (long long int i = id + 1; i < v.size(); i++) {
    if (v[i] != vl) {
      if (v[i] > vl) {
        tuple<long long int, long long int, long long int> tp =
            make_tuple(2, i, i - 1);
        v1.push_back(tp);
      } else {
        tuple<long long int, long long int, long long int> tp =
            make_tuple(1, i, i - 1);
        v1.push_back(tp);
      }
    }
  }
  cout << v1.size() << '\n';
  for (auto p : v1)
    cout << get<0>(p) << " " << get<1>(p) + 1 << " " << get<2>(p) + 1 << '\n';
}
