#include <bits/stdc++.h>
using namespace std;
const int N = 200000 + 5;
int n, a[N], cnt[N];
struct Node {
  int fi, se, th;
};
int main() {
  scanf("%d", &n);
  for (register int i = 1; i <= n; i++) scanf("%d", &a[i]), ++cnt[a[i]];
  int val1 = *max_element(cnt, cnt + 200000 + 1), val = 0;
  for (register int i = 0; i <= 200000; i++)
    if (cnt[i] == val1) val = i;
  int pos;
  for (register int i = 1; i <= n; i++)
    if (a[i] == val) pos = i;
  vector<Node> v;
  for (register int i = pos - 1; i >= 1; i--) {
    if (a[i] == val)
      continue;
    else if (a[i] < val) {
      v.push_back((Node){1, i, i + 1});
    } else if (a[i] > val) {
      v.push_back((Node){2, i, i + 1});
    }
  }
  for (register int i = pos + 1; i <= n; i++) {
    if (a[i] == val)
      continue;
    else if (a[i] < val) {
      v.push_back((Node){1, i, i - 1});
    } else if (a[i] > val) {
      v.push_back((Node){2, i, i - 1});
    }
  }
  cout << v.size() << endl;
  for (Node x : v) cout << x.fi << " " << x.se << " " << x.th << endl;
  return 0;
}
