#include <bits/stdc++.h>
using namespace std;
vector<long long int> a;
long long int nums[300000];
void FAST_IO();
int main() {
  long long int n, pos, mx = 0;
  cin >> n;
  for (long long int i = 0, temp; i < n; i++) {
    cin >> temp;
    a.push_back(temp);
    nums[temp]++;
    if (nums[temp] > mx) {
      mx = nums[temp];
      pos = i;
    }
  }
  cout << n - mx << '\n';
  for (long long int i = pos; i >= 1; i--) {
    if (a[i - 1] > a[i]) {
      a[i - 1] = a[i];
      cout << 2 << " " << i << " " << i + 1 << '\n';
    } else if (a[i - 1] < a[i]) {
      a[i - 1] = a[i];
      cout << 1 << " " << i << " " << i + 1 << '\n';
    }
  }
  for (long long int i = pos; i < n - 1; i++) {
    if (a[i + 1] > a[i]) {
      a[i + 1] = a[i];
      cout << 2 << " " << i + 2 << " " << i + 1 << '\n';
    } else if (a[i + 1] < a[i]) {
      a[i + 1] = a[i];
      cout << 1 << " " << i + 2 << " " << i + 1 << '\n';
    }
  }
  cout << '\n';
  return 0;
}
void FAST_IO() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
