#include <bits/stdc++.h>
using namespace std;
int n, a[200001], cell[200001], ans;
int main() {
  cin >> n;
  int max = -1, maxn = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    cell[a[i]]++;
    if (cell[a[i]] > max) {
      max = cell[a[i]];
      maxn = a[i];
    }
  }
  int index;
  for (int i = 0; i < n; i++) {
    if (a[i] != maxn) {
      ans++;
      if (a[i + 1] == maxn || a[i - 1] == maxn) {
        index = i;
      }
    }
  }
  cout << ans << endl;
  for (int i = index; i >= 0; i--) {
    if (a[i] != maxn && a[i + 1] == maxn && i + 1 < n) {
      if (a[i] > a[i + 1]) {
        cout << 2 << " ";
      } else {
        cout << 1 << " ";
      }
      a[i] = maxn;
      cout << i + 1 << " " << i + 2 << endl;
    }
  }
  for (int i = index; i < n; i++) {
    if (a[i] != maxn && a[i - 1] == maxn && i - 1 >= 0) {
      if (a[i] > a[i - 1]) {
        cout << 2 << " ";
      } else {
        cout << 1 << " ";
      }
      a[i] = maxn;
      cout << i + 1 << " " << i << endl;
    }
  }
  return 0;
}
