#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  std::vector<int> a(n);
  std::vector<int> count(1 + 2 * 100000);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    count[a[i]]++;
  }
  int maxCount = 0;
  int maxValue = 0;
  for (int i = 0; i < (int)count.size(); i++) {
    if (count[i] > maxCount) {
      maxCount = count[i];
      maxValue = i;
    }
  }
  printf("%d\n", n - maxCount);
  bool meetFirst = false;
  for (int i = 0; i < n; i++) {
    if (a[i] == maxValue) {
      if (!meetFirst) {
        for (int j = i - 1; j >= 0; j--) {
          if (a[j] < maxValue) {
            printf("1 %d %d\n", j + 1, j + 2);
          } else {
            printf("2 %d %d\n", j + 1, j + 2);
          }
        }
      }
      meetFirst = true;
    } else if (meetFirst) {
      if (a[i] < maxValue) {
        printf("1 %d %d\n", i + 1, i);
      } else {
        printf("2 %d %d\n", i + 1, i);
      }
    }
  }
  return 0;
}
