#include <bits/stdc++.h>
using namespace std;
int idx[200001], _idx = 0, max_1 = 0, val;
int main() {
  int n;
  cin >> n;
  int arr[n];
  vector<pair<int, pair<int, int> > > ans;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    idx[arr[i]]++;
    if (idx[arr[i]] > max_1) max_1 = idx[arr[i]], _idx = i, val = arr[i];
  }
  for (int i = _idx - 1; i >= 0; i--) {
    if (arr[i] != val) {
      int a = (arr[i] > val) ? 2 : 1;
      ans.push_back(make_pair(a, make_pair(i + 1, i + 2)));
    }
  }
  for (int i = _idx + 1; i < n; i++) {
    if (arr[i] != val) {
      int a = (arr[i] > val) ? 2 : 1;
      ans.push_back(make_pair(a, make_pair(i + 1, i)));
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++)
    cout << ans[i].first << ' ' << ans[i].second.first << ' '
         << ans[i].second.second << endl;
  return 0;
}
