#include <bits/stdc++.h>
using namespace std;
long long arr[200005], tmp[200005], max_value, n, temp, max_cnt;
bool visited[200005];
int main() {
  queue<long long> q;
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", &arr[i]);
    tmp[i] = arr[i];
  }
  sort(tmp + 1, tmp + n + 1);
  for (long long i = 1; i <= n; i++) {
    temp++;
    if (temp > max_cnt) {
      max_cnt = temp;
      max_value = tmp[i];
    }
    if (i < n && tmp[i] != tmp[i + 1]) temp = 0;
  }
  for (int i = 1; i <= n; i++) {
    if (arr[i] == max_value) {
      q.push(i);
      visited[i] = true;
    }
  }
  printf("%lld\n", n - max_cnt);
  while (!q.empty()) {
    long long go = q.front();
    q.pop();
    if (1 <= go - 1 && go - 1 <= n && arr[go - 1] != max_value &&
        !visited[go - 1]) {
      visited[go - 1] = true;
      q.push(go - 1);
      if (arr[go - 1] > max_value)
        printf("2 %lld %lld\n", go - 1, go);
      else
        printf("1 %lld %lld\n", go - 1, go);
      arr[go - 1] = max_value;
    }
    if (1 <= go + 1 && go + 1 <= n && arr[go + 1] != max_value &&
        !visited[go + 1]) {
      visited[go + 1] = true;
      q.push(go + 1);
      if (arr[go + 1] > max_value)
        printf("2 %lld %lld\n", go + 1, go);
      else
        printf("1 %lld %lld\n", go + 1, go);
      arr[go + 1] = max_value;
    }
  }
}
