#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n;
  cin >> n;
  vector<long long> a(n);
  vector<long long> b[2 * 100000 + 1];
  long long m = 0, mi = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[a[i]].push_back(i);
    if (b[a[i]].size() > m) {
      m = b[a[i]].size();
      mi = a[i];
    }
  }
  cout << n - m << endl;
  for (int j = 0; j < b[mi].size(); j++) {
    if (j > 0) {
      for (int k = b[mi][j] - 1; k > b[mi][j - 1]; k--) {
        if (a[k] > mi)
          cout << 2 << " " << k + 1 << " " << k + 2 << endl;
        else
          cout << 1 << " " << k + 1 << " " << k + 2 << endl;
      }
    } else {
      for (int k = b[mi][j] - 1; k >= 0; k--) {
        if (a[k] > mi)
          cout << 2 << " " << k + 1 << " " << k + 2 << endl;
        else
          cout << 1 << " " << k + 1 << " " << k + 2 << endl;
      }
    }
  }
  for (int k = b[mi][b[mi].size() - 1] + 1; k < n; k++) {
    if (a[k] > mi)
      cout << 2 << " " << k + 1 << " " << k << endl;
    else
      cout << 1 << " " << k + 1 << " " << k << endl;
  }
}
