#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long ct[2 * 100005] = {0};
  long long arr[2 * 100005] = {0};
  long long mct = 0, mx = -1;
  arr[0] = -1;
  for (long long i = 1; i <= n; i++) {
    cin >> arr[i];
    ct[arr[i]]++;
    if (ct[arr[i]] > mct) {
      mct = ct[arr[i]];
      mx = arr[i];
    }
  }
  vector<long long> pos;
  pos.emplace_back(-1);
  for (long long i = 1; i <= n; i++) {
    if (arr[i] == mx) {
      pos.emplace_back(i);
      arr[i] = -1;
    }
  }
  vector<pair<long long, pair<long long, long long>>> ans;
  for (long long i = 1; i < pos.size(); i++) {
    long long j = pos[i];
    while (arr[j - 1] != -1) {
      if (arr[j - 1] > mx)
        ans.emplace_back(make_pair(2, make_pair(j - 1, j)));
      else
        ans.emplace_back(make_pair(1, make_pair(j - 1, j)));
      arr[j] = -1;
      arr[j - 1] = -1;
      j--;
    }
  }
  for (long long i = pos[pos.size() - 1]; i <= n - 1; i++) {
    if (arr[i + 1] > mx)
      ans.emplace_back(make_pair(2, make_pair(i + 1, i)));
    else
      ans.emplace_back(make_pair(1, make_pair(i + 1, i)));
  }
  cout << n - (pos.size() - 1) << '\n';
  for (long long i = 0; i < ans.size(); i++)
    cout << ans[i].first << " " << (ans[i].second).first << " "
         << (ans[i].second).second << '\n';
  return 0;
}
