#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  vector<int> v;
  int count[4] = {0};
  for (int i = 0; i < t; i++) {
    int tm;
    cin >> tm;
    v.push_back(tm);
    count[tm]++;
  }
  int may = 10000;
  for (int i = 1; i < 4; i++) {
    may = min(may, count[i]);
  }
  cout << may << endl;
  while (may--) {
    for (int j = 1; j <= 3; j++) {
      for (int i = 0; i < t; i++) {
        if (v[i] == j) {
          cout << i + 1 << " ";
          v[i] = 0;
          break;
        }
      }
    }
    cout << endl;
  }
  return 0;
}
