#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> m(1000000, 0);
  int mx = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    m[a[i]] += 1;
  }
  for (int i = 0; i < n; i++) {
    if (m[a[i]] > m[a[mx]]) mx = i;
  }
  vector<int> op;
  vector<pair<int, int> > ans;
  for (int i = mx - 1; i >= 0; i--) {
    if (a[i] < a[mx]) {
      op.push_back(1);
      ans.push_back(make_pair(i, i + 1));
    }
    if (a[i] > a[mx]) {
      op.push_back(2);
      ans.push_back(make_pair(i, i + 1));
    }
  }
  for (int i = mx + 1; i < n; i++) {
    if (a[i] < a[mx]) {
      op.push_back(1);
      ans.push_back(make_pair(i, i - 1));
    }
    if (a[i] > a[mx]) {
      op.push_back(2);
      ans.push_back(make_pair(i, i - 1));
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++)
    cout << op[i] << " " << ans[i].first + 1 << " " << ans[i].second + 1
         << endl;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solve();
  return 0;
}
