#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, t, p[5001], m[5001], pe[5001],
      freq1 = 0, freq2 = 0, freq3 = 0, index1 = 0, index2 = 0, index3 = 0, w,
      res[5000][3], index4 = 0;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> t;
    if (t == 1) {
      freq1++;
      p[index1++] = i + 1;
    } else if (t == 2) {
      freq2++;
      m[index2++] = i + 1;
    } else if (t == 3) {
      freq3++;
      pe[index3++] = i + 1;
    }
  }
  if (freq1 <= freq2 && freq1 <= freq3)
    w = freq1;
  else if (freq2 <= freq1 && freq2 <= freq3)
    w = freq2;
  else
    w = freq3;
  for (i = 0; i < w; i++) {
    res[i][index4++] = p[i];
    res[i][index4++] = m[i];
    res[i][index4++] = pe[i];
    index4 = 0;
  }
  cout << w << endl;
  for (i = 0; i < w; i++) {
    for (j = 0; j < 3; j++) cout << res[i][j] << " ";
    cout << endl;
  }
  return 0;
}
