#include <bits/stdc++.h>
int main() {
  int NumOfStudent;
  int NumOfTeams;
  int ones = 0, twos = 0, threes = 0;
  int i, k, l, j, c, m, n, p;
  int a[5000];
  scanf("%d", &NumOfStudent);
  for (i = 0; i < NumOfStudent; i++) {
    scanf("%d", &a[i]);
  }
  for (i = 0; i < NumOfStudent; i++) {
    m = 0;
    n = 0;
    p = 0;
    for (m = 0; m < NumOfStudent; m++) {
      if (a[m] == 1) {
        ones = ones + 1;
      }
    }
    for (n = 0; n < NumOfStudent; n++) {
      if (a[n] == 2) {
        twos = twos + 1;
      }
    }
    for (p = 0; p < NumOfStudent; p++) {
      if (a[p] == 3) {
        threes = threes + 1;
      }
    }
    int b[3] = {ones, twos, threes};
    NumOfTeams = b[0];
    for (c = 1; c < 3; c++) {
      if (b[c] < NumOfTeams) {
        NumOfTeams = b[c];
      }
    }
    printf("\n%d", NumOfTeams);
    if (ones == 0 || twos == 0 || threes == 0) {
    } else {
      i = 0;
      j = 0;
      k = 0;
      l = 0;
      for (j = 0; j < NumOfTeams; j++) {
        while (i < NumOfStudent && a[i] != 1) {
          i++;
        }
        a[i] = 0;
        printf("\n%d ", i + 1);
        while (k < NumOfStudent && a[k] != 2) {
          k++;
        }
        a[k] = 0;
        printf("%d ", k + 1);
        while (l < NumOfStudent && a[l] != 3) {
          l++;
        }
        a[l] = 0;
        printf("%d ", l + 1);
      }
    }
    return 0;
  }
}
