#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
template <typename X>
inline X abs(const X& a) {
  return a < 0 ? -a : a;
}
template <typename X>
inline X sqr(const X& a) {
  return a * a;
}
const int size = 1e5 + 5;
const double eps = 0.0001;
const long double PI = 3.1415926535897932384626433832795;
const long long MOD = 1000000007;
const long long INF = 1LL << 62;
const long long MAX5 = 100001;
const long long MAX6 = 1000001;
const long long MAX17 = 99999999999999999;
const double DMAX = 2e18 + 5;
const int P = 239017;
void solution();
void include_file();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solution();
  return 0;
}
inline void include_file() {
  ios_base::sync_with_stdio(true);
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
inline bool isPrime(long long n) {
  for (int i = 2; i * i <= n; ++i)
    if (n % i == 0) return false;
  return true;
}
inline string ekv(string a) {
  if (a.size() & 1) return a;
  string x = ekv(a.substr(0, a.size() / 2));
  string y = ekv(a.substr(a.size() / 2));
  return min(x + y, y + x);
}
inline long long cubic_root(long long x) {
  long long l = 0, r = MAX6;
  while (l != r) {
    long long m = (l + r + 1) / 2;
    if (m * m * m > x)
      r = m - 1;
    else
      l = m;
  }
  return l;
}
inline float FastInvSqrt(float x) {
  float xhalf = 0.5f * x;
  int i = *(int*)&x;
  i = 0x5f3759df - (i >> 1);
  x = *(float*)&i;
  x = x * (1.5f - (xhalf * x * x));
  return x;
}
inline long long gcd(long long a, long long b) {
  while (b ^= a ^= b ^= a = a % b)
    ;
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
unsigned long long NCR(unsigned long long n, unsigned long long r) {
  if (r == 0) return 1;
  if (r > n >> 1) return NCR(n, n - r);
  unsigned long long res = 1;
  for (long long k = 1; k <= r; ++k) {
    res *= (unsigned long long)(n - k + 1);
    res /= k;
  }
  return res;
}
constexpr uint64_t mod = (1ull << 61) - 1;
inline uint64_t modmul(uint64_t a, uint64_t b) {
  uint64_t l1 = (uint32_t)a, h1 = a >> 32, l2 = (uint32_t)b, h2 = b >> 32;
  uint64_t l = l1 * l2, m = l1 * h2 + l2 * h1, h = h1 * h2;
  uint64_t ret =
      (l & mod) + (l >> 61) + (h << 3) + (m >> 29) + (m << 35 >> 3) + 1;
  ret = (ret & mod) + (ret >> 61);
  ret = (ret & mod) + (ret >> 61);
  return ret - 1;
}
void yes() { cout << "YES"; }
void no() { cout << "NO"; }
void yes(bool res, bool small = false) {
  if (!small) {
    if (res)
      cout << "YES";
    else
      cout << "NO";
  } else {
    if (res)
      cout << "Yes";
    else
      cout << "No";
  }
}
void dabl(double x) { printf("%.10lf", x); }
namespace bits {
template <typename X>
inline X MAX(const X& a, const X& b) {
  return b & ((a - b) >> 31) | a & (~(a - b) >> 31);
}
template <typename X>
inline X MIN(const X& a, const X& b) {
  return a & ((a - b) >> 31) | b & (~(a - b) >> 31);
}
inline bool check2(const long long n) { return n > 0 && (n & (n - 1)); }
inline long long ostatok2(const long long n, const long long m) {
  return m & (n - 1);
}
template <typename X>
inline void SWAP(X& a, X& b) {
  a ^= b;
  b ^= a;
  a ^= b;
}
inline size_t count_1_in_LL(unsigned long long n) {
  std::size_t i(0);
  for (; n; ++i) n &= n - 1;
  return i;
}
}  // namespace bits
void debug() { cout << endl; }
template <typename H, typename... T>
void debug(H p, T... t) {
  std::cout << p << " ";
  debug(t...);
}
vector<vector<int> > g;
inline void solution() {
  int n;
  cin >> n;
  int a[n];
  for (long long i = 0; i < n; ++i) cin >> a[i];
  ;
  map<int, set<int> > q;
  int ideal = 0, k = 0;
  for (long long i = 0; i < n; ++i) {
    q[a[i]].insert(i);
    if (q[a[i]].size() > k) {
      k = q[a[i]].size();
      ideal = a[i];
    }
  }
  set<int> pos = q[ideal];
  vector<pair<int, pair<int, int> > > res;
  int cur;
  while (pos.size() > 0) {
    cur = *pos.begin();
    for (int i = cur - 1; i >= 0; --i) {
      if (a[i] == ideal)
        break;
      else {
        if (a[i + 1] > a[i])
          res.push_back({1, {i + 1, i + 2}});
        else
          res.push_back({2, {i + 1, i + 2}});
        a[i] = ideal;
      }
    }
    pos.erase(cur);
  }
  if (cur != n - 1) {
    for (int i = cur + 1; i < n; ++i) {
      if (a[i - 1] > a[i])
        res.push_back({1, {i + 1, i}});
      else
        res.push_back({2, {i + 1, i}});
      a[i] = ideal;
    }
  }
  cout << res.size() << endl;
  for (auto x : res) {
    cout << x.first << " " << x.second.first << " " << x.second.second << endl;
  }
}

### Prompt

In cpp, your task is to solve the following problem:

You are given an array a consisting of n integers. You can perform the following operations arbitrary number of times (possibly, zero):

  1. Choose a pair of indices (i, j) such that |i-j|=1 (indices i and j are adjacent) and set a_i := a_i + |a_i - a_j|; 
  2. Choose a pair of indices (i, j) such that |i-j|=1 (indices i and j are adjacent) and set a_i := a_i - |a_i - a_j|. 



The value |x| means the absolute value of x. For example, |4| = 4, |-3| = 3.

Your task is to find the minimum number of operations required to obtain the array of equal elements and print the order of operations to do it.

It is guaranteed that you always can obtain the array of equal elements using such operations.

Note that after each operation each element of the current array should not exceed 10^{18} by absolute value.

Input

The first line of the input contains one integer n (1 ≤ n ≤ 2 ⋅ 10^5) — the number of elements in a.

The second line of the input contains n integers a_1, a_2, ..., a_n (0 ≤ a_i ≤ 2 ⋅ 10^5), where a_i is the i-th element of a.

Output

In the first line print one integer k — the minimum number of operations required to obtain the array of equal elements.

In the next k lines print operations itself. The p-th operation should be printed as a triple of integers (t_p, i_p, j_p), where t_p is either 1 or 2 (1 means that you perform the operation of the first type, and 2 means that you perform the operation of the second type), and i_p and j_p are indices of adjacent elements of the array such that 1 ≤ i_p, j_p ≤ n, |i_p - j_p| = 1. See the examples for better understanding.

Note that after each operation each element of the current array should not exceed 10^{18} by absolute value.

If there are many possible answers, you can print any.

Examples

Input


5
2 4 6 6 6


Output


2
1 2 3 
1 1 2 


Input


3
2 8 10


Output


2
2 2 1 
2 3 2 


Input


4
1 1 1 1


Output


0

### Response

```cpp
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
template <typename X>
inline X abs(const X& a) {
  return a < 0 ? -a : a;
}
template <typename X>
inline X sqr(const X& a) {
  return a * a;
}
const int size = 1e5 + 5;
const double eps = 0.0001;
const long double PI = 3.1415926535897932384626433832795;
const long long MOD = 1000000007;
const long long INF = 1LL << 62;
const long long MAX5 = 100001;
const long long MAX6 = 1000001;
const long long MAX17 = 99999999999999999;
const double DMAX = 2e18 + 5;
const int P = 239017;
void solution();
void include_file();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  solution();
  return 0;
}
inline void include_file() {
  ios_base::sync_with_stdio(true);
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
inline bool isPrime(long long n) {
  for (int i = 2; i * i <= n; ++i)
    if (n % i == 0) return false;
  return true;
}
inline string ekv(string a) {
  if (a.size() & 1) return a;
  string x = ekv(a.substr(0, a.size() / 2));
  string y = ekv(a.substr(a.size() / 2));
  return min(x + y, y + x);
}
inline long long cubic_root(long long x) {
  long long l = 0, r = MAX6;
  while (l != r) {
    long long m = (l + r + 1) / 2;
    if (m * m * m > x)
      r = m - 1;
    else
      l = m;
  }
  return l;
}
inline float FastInvSqrt(float x) {
  float xhalf = 0.5f * x;
  int i = *(int*)&x;
  i = 0x5f3759df - (i >> 1);
  x = *(float*)&i;
  x = x * (1.5f - (xhalf * x * x));
  return x;
}
inline long long gcd(long long a, long long b) {
  while (b ^= a ^= b ^= a = a % b)
    ;
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
unsigned long long NCR(unsigned long long n, unsigned long long r) {
  if (r == 0) return 1;
  if (r > n >> 1) return NCR(n, n - r);
  unsigned long long res = 1;
  for (long long k = 1; k <= r; ++k) {
    res *= (unsigned long long)(n - k + 1);
    res /= k;
  }
  return res;
}
constexpr uint64_t mod = (1ull << 61) - 1;
inline uint64_t modmul(uint64_t a, uint64_t b) {
  uint64_t l1 = (uint32_t)a, h1 = a >> 32, l2 = (uint32_t)b, h2 = b >> 32;
  uint64_t l = l1 * l2, m = l1 * h2 + l2 * h1, h = h1 * h2;
  uint64_t ret =
      (l & mod) + (l >> 61) + (h << 3) + (m >> 29) + (m << 35 >> 3) + 1;
  ret = (ret & mod) + (ret >> 61);
  ret = (ret & mod) + (ret >> 61);
  return ret - 1;
}
void yes() { cout << "YES"; }
void no() { cout << "NO"; }
void yes(bool res, bool small = false) {
  if (!small) {
    if (res)
      cout << "YES";
    else
      cout << "NO";
  } else {
    if (res)
      cout << "Yes";
    else
      cout << "No";
  }
}
void dabl(double x) { printf("%.10lf", x); }
namespace bits {
template <typename X>
inline X MAX(const X& a, const X& b) {
  return b & ((a - b) >> 31) | a & (~(a - b) >> 31);
}
template <typename X>
inline X MIN(const X& a, const X& b) {
  return a & ((a - b) >> 31) | b & (~(a - b) >> 31);
}
inline bool check2(const long long n) { return n > 0 && (n & (n - 1)); }
inline long long ostatok2(const long long n, const long long m) {
  return m & (n - 1);
}
template <typename X>
inline void SWAP(X& a, X& b) {
  a ^= b;
  b ^= a;
  a ^= b;
}
inline size_t count_1_in_LL(unsigned long long n) {
  std::size_t i(0);
  for (; n; ++i) n &= n - 1;
  return i;
}
}  // namespace bits
void debug() { cout << endl; }
template <typename H, typename... T>
void debug(H p, T... t) {
  std::cout << p << " ";
  debug(t...);
}
vector<vector<int> > g;
inline void solution() {
  int n;
  cin >> n;
  int a[n];
  for (long long i = 0; i < n; ++i) cin >> a[i];
  ;
  map<int, set<int> > q;
  int ideal = 0, k = 0;
  for (long long i = 0; i < n; ++i) {
    q[a[i]].insert(i);
    if (q[a[i]].size() > k) {
      k = q[a[i]].size();
      ideal = a[i];
    }
  }
  set<int> pos = q[ideal];
  vector<pair<int, pair<int, int> > > res;
  int cur;
  while (pos.size() > 0) {
    cur = *pos.begin();
    for (int i = cur - 1; i >= 0; --i) {
      if (a[i] == ideal)
        break;
      else {
        if (a[i + 1] > a[i])
          res.push_back({1, {i + 1, i + 2}});
        else
          res.push_back({2, {i + 1, i + 2}});
        a[i] = ideal;
      }
    }
    pos.erase(cur);
  }
  if (cur != n - 1) {
    for (int i = cur + 1; i < n; ++i) {
      if (a[i - 1] > a[i])
        res.push_back({1, {i + 1, i}});
      else
        res.push_back({2, {i + 1, i}});
      a[i] = ideal;
    }
  }
  cout << res.size() << endl;
  for (auto x : res) {
    cout << x.first << " " << x.second.first << " " << x.second.second << endl;
  }
}

```