#include <bits/stdc++.h>
using namespace std;
const long long N = 200003;
void solve() {
  long long n;
  cin >> n;
  long long ar[n], c[N] = {0};
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    c[ar[i]]++;
  }
  long long idx = 0, cm = 0;
  for (int i = 0; i < n; i++) {
    if (c[ar[i]] > cm) idx = i, cm = c[ar[i]];
  }
  if (cm == n) {
    cout << "0\n";
    return;
  }
  long long val = ar[idx];
  vector<pair<long long, pair<long long, long long> > > ans;
  for (long long i = idx - 1; i >= 0; i--) {
    if (ar[i] == val)
      continue;
    else if (ar[i] < val)
      ans.push_back(make_pair(1, make_pair(i + 1, i + 2)));
    else
      ans.push_back(make_pair(2, make_pair(i + 1, i + 2)));
  }
  for (long long i = idx + 1; i < n; i++) {
    if (ar[i] == val)
      continue;
    else if (ar[i] < val)
      ans.push_back(make_pair(1, make_pair(i + 1, i)));
    else
      ans.push_back(make_pair(2, make_pair(i + 1, i)));
  }
  cout << ans.size() << "\n";
  for (auto it : ans)
    cout << it.first << " " << it.second.first << " " << it.second.second
         << "\n";
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(NULL);
  solve();
  return 0;
}
