#include <bits/stdc++.h>
using namespace std;
const double PI = 2 * acos(0.0);
const double EPS = 1e-11;
const int sz = 1e6;
typedef unsigned long long ULL;
typedef long long LL;
typedef long long int64;
typedef unsigned long long uint64;
template <class T>
inline void checkmin(T &a, T b) {
  if (b < a) a = b;
}
template <class T>
inline void checkmax(T &a, T b) {
  if (b > a) a = b;
}
template <class T>
inline T sqr(T x) {
  return x * x;
}
template <class T>
inline T _max(T a, T b) {
  return (a > b) ? a : b;
}
template <class T>
inline T _min(T a, T b) {
  return (a < b) ? a : b;
}
template <class T>
inline T fAbs(T a) {
  return a < 0 ? a * (-1) : a;
}
template <class T>
inline void SWAP(T &a, T &b) {
  T t = a;
  a = b;
  b = t;
}
LL POW(LL base, LL power) {
  LL I, res = base;
  if (power == 0) return 1;
  for (I = 0; I < power - 1; I++) res *= base;
  return res;
}
bool isUpperCase(char c) { return c >= 'A' && c <= 'Z'; }
bool isLowerCase(char c) { return c >= 'a' && c <= 'z'; }
bool isVowel(char c) {
  return (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' ||
          c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U');
}
bool isLetter(char c) { return c >= 'A' && c <= 'Z' || c >= 'a' && c <= 'z'; }
bool isDigit(char c) { return c >= '0' && c <= '9'; }
char toLowerCase(char c) { return (isUpperCase(c)) ? (c + 32) : c; }
char toUpperCase(char c) { return (isLowerCase(c)) ? (c - 32) : c; }
int toInt(string s) {
  int r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
double toDouble(string s) {
  double r = 0;
  istringstream sin(s);
  sin >> r;
  return r;
}
string toString(int n) {
  string s;
  stringstream convert;
  convert << n;
  s = convert.str();
  return s;
}
string S, T;
char s[sz];
int ar[sz];
int t[sz];
int M[1000][1000];
int main() {
  int tcases, caseno = 1, n, I, J, K, N, cnt = 0, len, t1 = 0, t2 = 0, t3 = 0,
              team;
  scanf("%d", &n);
  for (I = 0; I < n; I++) {
    scanf("%d", &ar[I]);
    if (ar[I] == 1)
      t1++;
    else if (ar[I] == 2)
      t2++;
    else
      t3++;
  }
  t[0] = t1;
  t[1] = t2;
  t[2] = t3;
  sort(t, t + 3);
  team = t[0];
  printf("%d\n", team);
  while (team--) {
    t1 = 1, t2 = 1, t3 = 1;
    for (I = 0; I < n; I++) {
      if (!t1 && !t2 && !t3) break;
      if (ar[I] == 1 && t1) {
        printf("%d ", I + 1);
        t1 = 0;
        ar[I] = 0;
      } else if (ar[I] == 2 && t2) {
        printf("%d ", I + 1);
        t2 = 0;
        ar[I] = 0;
      } else if (ar[I] == 3 && t3) {
        printf("%d ", I + 1);
        t3 = 0;
        ar[I] = 0;
      }
    }
    printf("\n");
  }
  return 0;
}
