#include <bits/stdc++.h>
using namespace std;
const int maxN = 2e5 + 10;
int cnt[maxN];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int mx = 0, mxa, arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    cnt[arr[i]]++;
    if (cnt[arr[i]] > mx) mx = cnt[arr[i]], mxa = arr[i];
  }
  cout << n - mx << '\n';
  int i = 0, j = 0;
  while (arr[i] != mxa) i++;
  j = i;
  while (i > 0) {
    if (arr[i] < arr[i - 1])
      cout << "2 " << i << ' ' << i + 1 << '\n';
    else if (arr[i] > arr[i - 1])
      cout << "1 " << i << ' ' << i + 1 << '\n';
    arr[i - 1] = arr[i];
    i--;
  }
  while (j < n - 1) {
    if (arr[j] < arr[j + 1])
      cout << "2 " << j + 2 << ' ' << j + 1 << '\n';
    else if (arr[j] > arr[j + 1])
      cout << "1 " << j + 2 << ' ' << j + 1 << '\n';
    arr[j + 1] = arr[j];
    j++;
  }
  return 0;
}
