#include <bits/stdc++.h>
using namespace std;
template <typename T>
string to_str(T num) {
  stringstream stream;
  stream << num;
  return stream.str();
}
int to_int(string str) {
  int val;
  stringstream stream;
  stream << str;
  stream >> val;
  return val;
}
void omar_medhat() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); }
int Reverse(int val) {
  int rev = 0, rem;
  while (val != 0) {
    rem = val % 10;
    rev = rev * 10 + rem;
    val /= 10;
  }
  return rev;
}
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
bool prime(int x) {
  int counter = 0;
  for (int i = 1; i <= x; i++)
    if (x % i == 0) counter++;
  if (counter > 2)
    return 0;
  else
    return 1;
}
int main() {
  omar_medhat();
  long long k = 0, l = 0, m, n, cnt2 = 0, x, y, z, sum = 0, cnt1 = 0, cnt3 = 0,
            b = 0, d;
  vector<pair<long long, long long> > p;
  string s1, s2;
  cin >> z;
  for (int i = 0; i < z; i++) {
    cin >> d;
    if (d == 1)
      cnt1++;
    else if (d == 2)
      cnt2++;
    else if (d == 3)
      cnt3++;
    p.push_back(make_pair(d, i));
  }
  m = min(cnt1, min(cnt2, cnt3));
  cout << m << endl;
  sort(p.begin(), p.end());
  if (m != 0) {
    n = m;
    while (n--) {
      for (int i = 0; i < z; i++) {
        if (k == 0 && p[i].first == 1) {
          cout << p[i].second + 1 << " ";
          p[i].first = 0;
          k = 1;
        } else if (l == 0 && p[i].first == 2 && k == 1) {
          cout << p[i].second + 1 << " ";
          p[i].first = 0;
          l = 1;
        } else if (b == 0 && p[i].first == 3 && k == 1 && l == 1) {
          cout << p[i].second + 1;
          p[i].first = 0;
          b = 1;
        }
      }
      k = 0;
      l = 0;
      b = 0;
      cout << endl;
    }
  }
}
