#include <bits/stdc++.h>
using namespace std;
struct st {
  int ty, ii, jj;
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long tc;
  long long n;
  cin >> n;
  long long a[n + 5];
  map<long long, int> mp;
  long long posi;
  long long maxi = 0;
  vector<st> v;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mp[a[i]]++;
  }
  for (int i = 0; i < n; i++) {
    if (maxi < mp[a[i]]) {
      posi = i;
      maxi = mp[a[i]];
    }
  }
  int j = posi;
  long long cnt = 0;
  while (j > 0) {
    if (a[j] != a[j - 1]) {
      if (a[j - 1] < a[j]) {
        st x;
        x.ii = j - 1;
        x.jj = j;
        x.ty = 0;
        v.push_back(x);
      } else {
        st x;
        x.ii = j - 1;
        x.jj = j;
        x.ty = 1;
        v.push_back(x);
      }
      a[j - 1] = a[j];
      cnt++;
    }
    j--;
  }
  j = posi;
  while (j < n - 1) {
    if (a[j] != a[j + 1]) {
      if (a[j] < a[j + 1]) {
        st x;
        x.ii = j + 1;
        x.jj = j;
        x.ty = 1;
        v.push_back(x);
      } else {
        st x;
        x.ii = j + 1;
        x.jj = j;
        x.ty = 0;
        v.push_back(x);
      }
      a[j + 1] = a[j];
      cnt++;
    }
    j++;
  }
  cout << cnt << endl;
  for (int i = 0; i < v.size(); i++) {
    cout << v[i].ty + 1 << ' ' << v[i].ii + 1 << ' ' << v[i].jj + 1 << endl;
  }
  return 0;
}
