#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1e9 + 7;
void boost() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  boost();
  long long int n, arr[200005], visit[200005], i, j,
      oc = 0, x, maxi = -1, ds = 0, minid = 200005, maxid = 200005;
  cin >> n;
  memset(visit, 0, sizeof(visit));
  for (i = 1; i <= n; i++) {
    cin >> arr[i];
    if (visit[arr[i]] == 0) ds++;
    visit[arr[i]]++;
    if (visit[arr[i]] > oc) {
      oc = visit[arr[i]];
      x = arr[i];
      minid = i;
    }
    if (arr[i] > maxi) {
      maxi = arr[i];
      maxid = i;
    }
  }
  if (ds == 1) {
    cout << "0" << endl;
    return 0;
  }
  if (oc == 1) {
    cout << n - 1 << endl;
    for (j = maxid; j < n; j++) {
      cout << "1"
           << " " << j + 1 << " " << j << endl;
    }
    for (j = maxid; j > 1; j--) {
      cout << "1"
           << " " << j - 1 << " " << j << endl;
    }
  } else {
    cout << n - visit[x] << endl;
    for (i = 1; i <= n; i++) {
      if (arr[i] == x) {
        minid = i;
        break;
      }
    }
    for (i = minid; i > 1; i--) {
      if (arr[i - 1] > x)
        cout << "2"
             << " " << i - 1 << " " << i << endl;
      else
        cout << "1"
             << " " << i - 1 << " " << i << endl;
    }
    for (i = minid; i < n; i++) {
      for (j = i + 1; j <= n; j++) {
        if (x == arr[j]) break;
        if (arr[j] > x)
          cout << "2"
               << " " << j << " " << j - 1 << endl;
        else
          cout << "1"
               << " " << j << " " << j - 1 << endl;
      }
      i = j - 1;
    }
  }
  return 0;
}
