#include <bits/stdc++.h>
using namespace std;
int n, m, A[2 * 100000 + 2];
int DD[2 * 100000 + 2];
vector<int> POS;
vector<pair<int, pair<int, int> > > ANS;
void solve() {
  cin >> n;
  int mn = INT_MIN, val;
  for (int i = 1; i <= n; ++i) {
    cin >> A[i];
    DD[A[i]]++;
    if (mn < DD[A[i]]) {
      mn = DD[A[i]];
      val = A[i];
    }
  }
  for (int i = 1; i <= n; ++i) {
    if (val == A[i]) {
      POS.push_back(i);
    }
  }
  for (int i = 1; i < POS.size(); ++i) {
    for (int j = POS[i] - 1; j > POS[i - 1]; --j) {
      if (A[j] > val) {
        ANS.push_back({2, {j, j + 1}});
      }
      if (A[j] < val) {
        ANS.push_back({1, {j, j + 1}});
      }
    }
  }
  for (int i = POS[0] - 1; i >= 1; --i) {
    if (A[i] > val) {
      ANS.push_back({2, {i, i + 1}});
    }
    if (A[i] < val) {
      ANS.push_back({1, {i, i + 1}});
    }
  }
  for (int i = POS[POS.size() - 1] + 1; i <= n; ++i) {
    if (A[i] > val) {
      ANS.push_back({2, {i, i - 1}});
    }
    if (A[i] < val) {
      ANS.push_back({1, {i, i - 1}});
    }
  }
  cout << ANS.size() << '\n';
  for (auto x : ANS) {
    cout << x.first << ' ' << x.second.first << ' ' << x.second.second << '\n';
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  ;
  solve();
  return 0;
}
