#include <bits/stdc++.h>
int n[5005], a[5005], b[5005], c[5005];
int main() {
  memset(n, 0, sizeof(n));
  memset(a, 0, sizeof(a));
  memset(b, 0, sizeof(b));
  memset(c, 0, sizeof(c));
  int T, an = 0, bn = 0, cn = 0;
  scanf("%d", &T);
  for (int i = 1; i <= T; i++) {
    scanf("%d", &n[i]);
    switch (n[i]) {
      case 1:
        a[an++] = i;
        break;
      case 2:
        b[bn++] = i;
        break;
      case 3:
        c[cn++] = i;
        break;
    }
  }
  int cut = (an > bn) ? ((bn > cn) ? (cn) : bn) : ((an > cn) ? (cn) : an);
  printf("%d\n", cut);
  for (int i = 0; i < cut; i++) {
    printf("%d %d %d\n", a[i], b[i], c[i]);
  }
}
