#include <bits/stdc++.h>
using namespace std;
const int N = 200050;
int main() {
  int tcase = 1, cas = 1;
  while (tcase--) {
    int n;
    scanf("%d", &n);
    vector<long long int> v;
    int a;
    map<int, int> m;
    int x, mx = 0, pos;
    for (int i = 0; i < n; i++) {
      scanf("%d", &a);
      v.push_back(a);
      m[a]++;
      if (mx <= m[a]) {
        mx = m[a];
        x = a;
        pos = i;
      }
    }
    printf("%d\n", n - m[x]);
    for (int i = pos - 1; i >= 0; i--) {
      if (v[i] > x) {
        printf("2 %d %d\n", i + 1, i + 2);
        v[i] = x;
      } else if (v[i] < x) {
        printf("1 %d %d\n", i + 1, i + 2);
        v[i] = x;
      }
    }
    for (int i = pos + 1; i < n; i++) {
      if (v[i] > x) {
        printf("2 %d %d\n", i + 1, i);
        v[i] = x;
      } else if (v[i] < x) {
        printf("1 %d %d\n", i + 1, i);
        v[i] = x;
      }
    }
  }
  return 0;
}
