#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, arr[5001], t1[5001], t2[5001], t3[5001];
  cin >> n;
  int count1 = 0, count2 = 0, count3 = 0, pos1 = 1, pos2 = 1, pos3 = 1, maxteam;
  for (int i = 1; i <= n; i++) {
    cin >> arr[i];
  }
  for (int i = 1; i <= n; i++) {
    if (arr[i] == 1) {
      t1[pos1++] = i;
      count1++;
    }
    if (arr[i] == 2) {
      t2[pos2++] = i;
      count2++;
    }
    if (arr[i] == 3) {
      t3[pos3++] = i;
      count3++;
    }
  }
  if (count1 <= count2 && count1 <= count3) {
    maxteam = count1;
  } else if (count2 <= count1 && count2 <= count3) {
    maxteam = count2;
  } else {
    maxteam = count3;
  }
  cout << maxteam << endl;
  for (int i = 1; i <= maxteam; i++) {
    cout << t1[i] << " " << t2[i] << " " << t3[i] << endl;
  }
}
