#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
int const MAXN = 250000;
int cnt[MAXN], best = 0, ibest, ind;
struct ris {
  int a, b, c;
};
int main() {
  cin.tie(0), cin.sync_with_stdio(0), cout.tie(0), cout.sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    cnt[v[i]]++;
    if (cnt[v[i]] >= best) {
      best = cnt[v[i]];
      ibest = v[i];
      ind = i;
    }
  }
  vector<ris> risposta;
  for (int i = ind - 1; i >= 0; i--) {
    if (v[i] == v[i + 1]) continue;
    if (v[i] < v[i + 1])
      risposta.push_back({1, i + 1, i + 2});
    else
      risposta.push_back({2, i + 1, i + 2});
    v[i] = ibest;
  }
  for (int i = ind + 1; i < n; i++) {
    if (v[i] == v[i - 1]) continue;
    if (v[i] < v[i - 1])
      risposta.push_back({1, i + 1, i});
    else
      risposta.push_back({2, i + 1, i});
    v[i] = ibest;
  }
  cout << risposta.size() << "\n";
  for (auto x : risposta) cout << x.a << " " << x.b << " " << x.c << "\n";
}
