#include <bits/stdc++.h>
using namespace std;
long long int powr(long long a, long long b) {
  if (b == 0) {
    return 1;
  }
  if (b % 2 == 0) {
    return powr(((a % 1000000007) * (a % 1000000007)) % 1000000007, b / 2);
  } else {
    if (b == 1) {
      return a;
    } else {
      return (a * powr(((a % 1000000007) * (a % 1000000007) % 1000000007),
                       (b - 1) / 2)) %
             1000000007;
    }
  }
}
long long gcd1(long long a, long long b) {
  if (a == 0)
    return b;
  else {
    return gcd1(b % a, a);
  }
}
long long lcm(long long a, long long b) { return (a * b) / gcd1(a, b); }
int mod1(int a) {
  if (a < 0)
    return -1 * a;
  else {
    return a;
  }
}
bool isPrime(int num) {
  bool flag = true;
  for (int i = 2; i <= num / 2; i++) {
    if (num % i == 0) {
      flag = false;
      break;
    }
  }
  return flag;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int r;
  r = 1;
  for (long long k = 0; k < r; k++) {
    long long n, got, got1, got2, max = 0, arr[1000000];
    map<int, int> brr;
    cin >> n;
    for (int i = 0; i < n; i++) {
      cin >> arr[i];
      brr[arr[i]]++;
      if (brr[arr[i]] > max) {
        max = brr[arr[i]];
        got = i;
      }
    }
    got1 = got2 = got;
    got1--;
    cout << n - max << "\n";
    if (n - max > 0) {
      while (got1 >= 0) {
        if (arr[got1] < arr[got]) {
          cout << 1 << " " << got1 + 1 << " " << got1 + 2;
          cout << "\n";
        }
        if (arr[got1] > arr[got]) {
          cout << 2 << " " << got1 + 1 << " " << got1 + 2;
          cout << "\n";
        }
        got1--;
      }
      got2++;
      while (got2 < n) {
        if (arr[got2] < arr[got]) {
          cout << 1 << " " << got2 + 1 << " " << got2;
          cout << "\n";
        }
        if (arr[got2] > arr[got]) {
          cout << 2 << " " << got2 + 1 << " " << got2;
          cout << "\n";
        }
        got2++;
      }
    }
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
}
