#include <bits/stdc++.h>
using namespace std;
void execute();
int main() {
  ios_base::sync_with_stdio(0);
  execute();
  return 0;
}
void execute() {
  long long n;
  cin >> n;
  map<int, int> mp;
  vector<long long> in(n);
  for (int i = 0; i < n; i++) {
    cin >> in[i];
    mp[in[i]]++;
  }
  int ch = in[0], ind;
  for (auto i : mp)
    if (i.second > mp[ch]) ch = i.first;
  for (int i = 0; i < n; i++)
    if (in[i] == ch) {
      ind = i;
      break;
    }
  cout << n - mp[ch] << '\n';
  for (int i = ind + 1; i < n; i++) {
    if (in[i] == ch) continue;
    if (in[i] > ch)
      cout << 2 << ' ' << i + 1 << ' ' << i << '\n';
    else
      cout << 1 << ' ' << i + 1 << ' ' << i << '\n';
  }
  for (int i = ind - 1; i >= 0; i--) {
    if (in[i] == ch) continue;
    if (in[i] > ch)
      cout << 2 << ' ' << i + 1 << ' ' << i + 2 << '\n';
    else
      cout << 1 << ' ' << i + 1 << ' ' << i + 2 << '\n';
  }
}
