#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1000000000 + 7;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  vector<long long> arr(n);
  vector<long long> hash(200005, 0);
  long long maxx = 0;
  long long value = 0;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    hash[arr[i]] += 1;
    if (maxx <= hash[arr[i]]) {
      value = arr[i];
      maxx = hash[arr[i]];
    }
  }
  vector<long long> index;
  for (long long i = 0; i < n; i++) {
    if (arr[i] == value) index.push_back(i);
  }
  cout << n - hash[value] << endl;
  if (n - hash[value] == 0) return 0;
  for (long long t = 0; t < index.size(); t++) {
    long long i = index[t];
    while (i - 1 >= 0) {
      if (arr[i - 1] > arr[i]) {
        cout << 2 << " " << i << " " << i + 1 << endl;
        arr[i - 1] = arr[i];
      } else if (arr[i - 1] < arr[i]) {
        cout << 1 << " " << i << " " << i + 1 << endl;
        arr[i - 1] = arr[i];
      } else if (arr[i - 1] == arr[i])
        break;
      i--;
    }
    i = index[t];
    while (i + 1 < n) {
      if (arr[i + 1] > arr[i]) {
        cout << 2 << " " << i + 2 << " " << i + 1 << endl;
        arr[i + 1] = arr[i];
      } else if (arr[i + 1] < arr[i]) {
        cout << 1 << " " << i + 2 << " " << i + 1 << endl;
        arr[i + 1] = arr[i];
      } else if (arr[i + 1] == arr[i])
        break;
      i++;
    }
  }
  return 0;
}
