#include <bits/stdc++.h>
using namespace std;
const long long N = 2e5 + 50;
const long long mod = 1e9 + 7;
const long long inf = 1e17;
long long dx[] = {0, 1, -1, 0, -1, 1, 1, -1};
long long dy[] = {1, 0, 0, -1, -1, 1, -1, 1};
long long arr[N];
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n;
  cin >> n;
  map<long long, long long> mp;
  for (long long i = 1; i <= n; i++) {
    cin >> arr[i];
    mp[arr[i]]++;
  }
  long long mx = 0, mmx = 0;
  for (auto v : mp) {
    if (v.second > mmx) {
      mx = v.first;
      mmx = v.second;
    }
  }
  long long op = n - mmx;
  cout << op << endl;
  if (op) {
    stack<pair<long long, long long> > st, tt;
    for (long long i = 1; i <= n; i++) {
      if (mx == arr[i]) {
        while (!st.empty()) {
          long long ty = st.top().first;
          long long in = st.top().second;
          cout << ty << " " << in << " " << in + 1 << endl;
          st.pop();
        }
      } else {
        if (arr[i] < mx) {
          st.push({1, i});
        } else {
          st.push({2, i});
        }
      }
    }
    while (!st.empty()) {
      long long ty = st.top().first;
      long long in = st.top().second;
      tt.push({ty, in});
      st.pop();
    }
    while (!tt.empty()) {
      long long ty = tt.top().first;
      long long in = tt.top().second;
      cout << ty << " " << in << " " << in - 1 << endl;
      tt.pop();
    }
  }
}
