#include <bits/stdc++.h>
using namespace std;
const int adj[8][2] = {{-1, 0},  {0, -1}, {1, 0}, {0, 1},
                       {-1, -1}, {-1, 1}, {1, 1}, {1, -1}};
const long long int LLINF = 9e18;
const int INF = 2e9;
const int MOD = 1e9 + 7;
const double EPS = 1e-10;
const double PI = acos(-1);
const int SIZE = 200005;
int N;
long long int A[SIZE];
int cnt[SIZE], pos[SIZE];
vector<pair<int, pair<int, int> > > ans;
int main() {
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%lld", &A[i]);
    cnt[A[i]]++;
    pos[A[i]] = i;
  }
  int num, Mx = 0, idx;
  for (int i = 0; i < SIZE; i++) {
    if (Mx < cnt[i]) {
      num = i;
      Mx = cnt[i];
      idx = pos[i];
    }
  }
  for (int i = idx; i <= N; i++) {
    if (num < A[i]) {
      ans.push_back(make_pair(2, make_pair(i, i - 1)));
    } else if (num > A[i]) {
      ans.push_back(make_pair(1, make_pair(i, i - 1)));
    }
  }
  for (int i = idx; i >= 1; i--) {
    if (num < A[i]) {
      ans.push_back(make_pair(2, make_pair(i, i + 1)));
    } else if (num > A[i]) {
      ans.push_back(make_pair(1, make_pair(i, i + 1)));
    }
  }
  int n = ans.size();
  printf("%d\n", n);
  for (int i = 0; i < n; i++) {
    printf("%d %d %d\n", ans[i].first, ans[i].second.first,
           ans[i].second.second);
  }
  return 0;
}
