#include <bits/stdc++.h>
using namespace std;
long long dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
void test_cases() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  map<long long, long long> m;
  for (auto x : a) {
    m[x]++;
  }
  long long maxf = m[a[0]], maxn = a[0];
  for (auto x : m) {
    if (x.second > maxf) {
      maxn = x.first;
      maxf = x.second;
    }
  }
  vector<bool> good(n);
  for (long long i = 0; i < n; i++) {
    if (a[i] == maxn) {
      good[i] = true;
    }
  }
  vector<pair<pair<long long, long long>, long long>> ans;
  long long idx = 0;
  for (long long i = 0; i < n; i++) {
    if (good[i]) {
      idx = i;
      break;
    }
  }
  for (long long i = idx - 1; i >= 0; i--) {
    if (a[i] < maxn) {
      ans.push_back({{i, i + 1}, 1});
    } else {
      ans.push_back({{i, i + 1}, 2});
    }
  }
  for (long long i = idx + 1; i < n; i++) {
    if (good[i]) {
      continue;
    } else if (a[i] < maxn) {
      ans.push_back({{i, i - 1}, 1});
    } else {
      ans.push_back({{i, i - 1}, 2});
    }
  }
  cout << (long long)ans.size() << '\n';
  ;
  if (!ans.empty()) {
    for (auto x : ans) {
      cout << x.second << " " << x.first.first + 1 << " " << x.first.second + 1
           << '\n';
      ;
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ;
  long long t = 1;
  while (t--) {
    test_cases();
  }
}
