#include <bits/stdc++.h>
using namespace std;
long long freq[200003];
vector<pair<long long, pair<long long, long long> > > ans;
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ans.clear();
  long long n;
  cin >> n;
  long long a[n + 1], i, j, k;
  for (i = 1; i <= n; ++i) {
    cin >> a[i];
    freq[a[i]]++;
  }
  long long val, ma = 0;
  for (i = 0; i <= 200003 - 3; ++i) {
    if (ma < freq[i]) {
      ma = freq[i];
      val = i;
    }
  }
  vector<long long> v;
  v.clear();
  for (i = 1; i <= n; ++i) {
    if (a[i] == val) v.push_back(i);
  }
  j = v[v.size() - 1] - 1;
  while (j >= 1) {
    if (a[j] > val) {
      ans.push_back({2, {j, j + 1}});
    } else if (a[j] < val) {
      ans.push_back({1, {j, j + 1}});
    }
    --j;
  }
  j = v[v.size() - 1] + 1;
  while (j <= n) {
    if (a[j] > val) {
      ans.push_back({2, {j, j - 1}});
    } else if (a[j] < val) {
      ans.push_back({1, {j, j - 1}});
    }
    ++j;
  }
  cout << ans.size() << "\n";
  for (i = 0; i < ans.size(); ++i) {
    cout << ans[i].first << " " << ans[i].second.first << " "
         << ans[i].second.second << "\n";
  }
  return 0;
}
