#include <bits/stdc++.h>
using namespace std;
vector<long long int> cnt[200005];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int n;
  cin >> n;
  long long int a[n + 1];
  for (long long int i = 1; i <= n; i++) {
    long long int x;
    cin >> x;
    a[i] = x;
    cnt[x].push_back(i);
  }
  long long int mx = 0, mxi = 0;
  for (long long int i = 0; i < 200005; i++)
    if (cnt[i].size() > mx) mx = cnt[i].size(), mxi = i;
  cout << n - mx << '\n';
  long long int l = 1, r = n;
  for (long long int i = 0; i < mx; i++) {
    r = cnt[mxi][i];
    for (long long int j = r - 1; j >= l; j--) {
      if (a[j] > mxi)
        cout << 2 << " " << j << " " << j + 1 << '\n';
      else
        cout << 1 << " " << j << " " << j + 1 << '\n';
    }
    l = r + 1;
  }
  for (long long int j = l; j <= n; j++) {
    if (a[j] > mxi)
      cout << 2 << " " << j << " " << j - 1 << '\n';
    else
      cout << 1 << " " << j << " " << j - 1 << '\n';
  }
}
