#include <bits/stdc++.h>
long long ans;
using namespace std;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, b = 0, ma = 0;
  cin >> n;
  long long a[n];
  for (long long i = (long long)0; i < (long long)n; i++) cin >> a[i];
  long long c[n], k;
  for (long long i = (long long)0; i < (long long)n; i++) c[i] = a[i];
  sort(c, c + n);
  long long max_count = 1, res = c[0], curr_count = 1;
  for (long long i = 1; i < n; i++) {
    if (c[i] == c[i - 1])
      curr_count++;
    else {
      if (curr_count > max_count) {
        max_count = curr_count;
        res = c[i - 1];
      }
      curr_count = 1;
    }
  }
  if (curr_count > max_count) {
    max_count = curr_count;
    res = c[n - 1];
  }
  b = res;
  for (long long i = (long long)0; i < (long long)n; i++)
    if (a[i] == b) ma++;
  cout << n - ma << endl;
  for (long long i = (long long)0; i < (long long)n; i++) {
    if (a[i] == b) {
      k = i;
      break;
    }
  }
  for (long long i = k; i >= 1; i--) {
    if (a[i - 1] < a[i]) {
      cout << 1 << " " << i << " " << i + 1 << endl;
      a[i - 1] = b;
    } else if (a[i] < a[i - 1]) {
      cout << 2 << " " << i << " " << i + 1 << endl;
      a[i - 1] = b;
    }
  }
  for (long long i = k; i < n - 1; i++) {
    if (a[i + 1] < a[i]) {
      cout << 1 << " " << i + 2 << " " << i + 1 << endl;
      a[i + 1] = b;
    } else if (a[i] < a[i + 1]) {
      cout << 2 << " " << i + 2 << " " << i + 1 << endl;
      a[i + 1] = b;
    }
  }
}
