#include <bits/stdc++.h>
using namespace std;
template <class T>
bool mmin(T &a, T b) {
  return (a > b ? (a = b, true) : false);
};
template <class T>
bool mmax(T &a, T b) {
  return (a < b ? (a = b, true) : false);
};
int freq[200002];
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  scanf("%d", &n);
  vector<int> A(n);
  for (auto &a : A) {
    scanf("%d", &a);
    freq[a]++;
  }
  pair<int, int> val = {0, 0};
  int pos = 0;
  for (int i = 0; i <= 200000; i++)
    if (freq[i] > val.first) val = {freq[i], i};
  for (int i = 0; i < n; i++) {
    if (val.second == A[i]) {
      pos = i;
      break;
    }
  }
  vector<pair<int, pair<int, int>>> out;
  int save = pos;
  while (pos > 0) {
    int k = abs(A[pos - 1] - A[pos]);
    if (A[pos - 1] > A[pos]) {
      out.push_back({2, {pos - 1, pos}});
    } else {
      out.push_back({1, {pos - 1, pos}});
    }
    A[pos - 1] = A[pos];
    pos--;
  }
  pos = save;
  while (pos < (n - 1)) {
    if (A[pos + 1] != A[pos]) {
      int k = abs(A[pos + 1] - A[pos]);
      if (A[pos + 1] > A[pos]) {
        out.push_back({2, {pos + 1, pos}});
      } else {
        out.push_back({1, {pos + 1, pos}});
      }
      A[pos + 1] = A[pos];
    }
    pos++;
  }
  cout << (int)out.size() << '\n';
  for (auto a : out)
    cout << a.first << " " << a.second.first + 1 << " " << a.second.second + 1
         << '\n';
  return 0;
}
