#include <bits/stdc++.h>
using namespace std;
const char NL = '\n';
clock_t startTime;
double getCurrentTime() {
  return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}
void readarray(vector<long long int> &a) {
  for (auto &it : a) cin >> it;
}
void solve() {
  long long int n;
  cin >> n;
  vector<long long int> a(n);
  readarray(a);
  map<long long int, long long int> st;
  for (long long int i = 0; i < n; i++) st[a[i]]++;
  if ((long long int)st.size() == 1) {
    cout << 0 << NL;
  } else {
    long long int mv = LLONG_MIN;
    long long int ele;
    for (pair<long long int, long long int> a : st) {
      if (a.second > mv) {
        mv = a.second;
        ele = a.first;
      }
    }
    cout << n - st[ele] << NL;
    long long int in = find(a.begin(), a.end(), ele) - a.begin();
    for (long long int i = in + 1; i < n; i++) {
      if (a[i] != ele) {
        if (a[i] > ele)
          cout << 2 << " ";
        else
          cout << 1 << " ";
        cout << i + 1 << " " << i << NL;
      }
    }
    for (long long int i = in - 1; i >= 0; i--) {
      if (a[i] != ele) {
        if (a[i] > ele)
          cout << 2 << " ";
        else
          cout << 1 << " ";
        cout << i + 1 << " " << i + 2 << NL;
      }
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  startTime = clock();
  solve();
  fflush(stdin);
  fflush(stdout);
  return 0;
}
