#include <bits/stdc++.h>
using namespace std;
long long N, arr[200001], mx, pos, cnt, chk[200001];
vector<pair<int, pair<int, int> > > a, b;
int main() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> arr[i];
    chk[arr[i]]++;
  }
  for (int i = 0; i < N; i++) {
    if (chk[arr[i]] > mx) mx = chk[arr[i]], pos = i;
  }
  for (int i = pos - 1; i >= 0; i--) {
    if (arr[i] > arr[i + 1]) {
      cnt++;
      a.push_back(make_pair(2, make_pair(i + 1, i + 2)));
    } else if (arr[i] < arr[i + 1]) {
      cnt++;
      a.push_back(make_pair(1, make_pair(i + 1, i + 2)));
    }
    arr[i] = arr[i + 1];
  }
  for (int i = pos + 1; i < N; i++) {
    if (arr[i - 1] > arr[i]) {
      cnt++;
      b.push_back(make_pair(1, make_pair(i + 1, i)));
    } else if (arr[i - 1] < arr[i]) {
      cnt++;
      b.push_back(make_pair(2, make_pair(i + 1, i)));
    }
    arr[i] = arr[i - 1];
  }
  cout << cnt << "\n";
  for (int i = 0; i < a.size(); i++)
    cout << a[i].first << " " << a[i].second.first << " " << a[i].second.second
         << "\n";
  for (int i = 0; i < b.size(); i++)
    cout << b[i].first << " " << b[i].second.first << " " << b[i].second.second
         << "\n";
}
