#include <bits/stdc++.h>
using namespace std;
const int up = 1e3 + 1;
int main() {
  int n;
  cin >> n;
  vector<int> v1;
  ;
  vector<int> v2;
  ;
  vector<int> v3;
  ;
  for (int i = int(1); i <= int(n); i++) {
    int temp;
    cin >> temp;
    if (temp == 1)
      v1.push_back(i);
    else if (temp == 2)
      v2.push_back(i);
    else
      v3.push_back(i);
  }
  int l1 = ((int)(v1).size());
  int l2 = ((int)(v2).size());
  int l3 = ((int)(v3).size());
  int mini = min(l1, min(l2, l3));
  printf("%d\n", mini);
  if (mini != 0) {
    for (int i = 0; i < mini; i++) {
      printf("%d %d %d\n", v1[i], v2[i], v3[i]);
    }
  }
  return 0;
}
