#include <bits/stdc++.h>
using namespace std;
struct query {
  long long t, fi, si;
};
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long a[n];
  map<long long, long long> f;
  for (long long i = 0; i < n; i++) {
    long long x;
    cin >> x;
    a[i] = x;
    f[x]++;
  }
  long long maxn, maxf = -1;
  for (auto i : f) {
    if (i.second > maxf) {
      maxf = i.second;
      maxn = i.first;
    }
  }
  vector<long long> index;
  for (long long i = 0; i < n; i++) {
    if (a[i] == maxn) index.push_back(i);
  }
  vector<query> ans;
  for (auto i : index) {
    long long j = i - 1;
    while (a[j] != maxn && j >= 0) {
      if (a[j] > a[j + 1]) {
        ans.push_back({2, j + 1, j + 2});
        a[j] = maxn;
      } else if (a[j] < a[j + 1]) {
        ans.push_back({1, j + 1, j + 2});
        a[j] = maxn;
      }
      j--;
    }
  }
  long long j = index.back() + 1;
  while (j < n) {
    if (a[j] > a[j - 1]) {
      ans.push_back({2, j + 1, j});
      a[j] = maxn;
    } else if (a[j] < a[j - 1]) {
      ans.push_back({1, j + 1, j});
      a[j] = maxn;
    }
    j++;
  }
  cout << ans.size() << "\n";
  for (auto i : ans) cout << i.t << ' ' << i.fi << ' ' << i.si << "\n";
  return 0;
}
