#include <bits/stdc++.h>
using namespace std;
int main() {
  int arr[5001], n, sum1 = 0, sum2 = 0, sum3 = 0, w = 0, c = 1, k = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] == 1) sum1++;
    if (arr[i] == 2) sum2++;
    if (arr[i] == 3) sum3++;
  }
  while (sum1 > 0 && sum2 > 0 && sum3 > 0) {
    w++;
    sum1--, sum2--, sum3--;
  }
  if (w == 0) {
    cout << 0 << endl;
    return 0;
  }
  cout << w << endl;
  for (int i = 0; i < n && k < w; i++) {
    if (arr[i] == c) {
      cout << i + 1 << " ";
      c++;
      arr[i] = 0;
      i = -1;
    }
    if (c == 4) {
      c = 1;
      k++;
      cout << endl;
    }
  }
  return 0;
}
