#include <bits/stdc++.h>
int main() {
  int array[5001], array1[5001], array2[5001], array3[5001];
  int i, n, find1, find2, find3, index1, index2, index3, team;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &array[i]);
  }
  find1 = find2 = find3 = 0;
  index1 = index2 = index3 = 1;
  for (i = 0; i < n; i++) {
    if (array[i] == 1) {
      array1[index1++] = i + 1;
      find1++;
    } else if (array[i] == 2) {
      array2[index2++] = i + 1;
      find2++;
    } else if (array[i] == 3) {
      array3[index3++] = i + 1;
      find3++;
    }
  }
  if (find1 <= find2 && find1 <= find3) {
    team = find1;
  } else if (find2 <= find1 && find2 <= find3) {
    team = find2;
  } else if (find3 <= find1 && find3 <= find2) {
    team = find3;
  }
  printf("%d\n", team);
  for (i = 1; i <= team; i++) {
    printf("%d %d %d\n", array1[i], array2[i], array3[i]);
  }
  return 0;
}
