#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  scanf("%d ", &n);
  vector<vector<int> > v(3);
  for (int i = 0; i < (int)(n); i++) {
    int a;
    scanf("%d ", &a);
    v[a - 1].push_back(i + 1);
  }
  int r = 0x7FFFFFFF;
  for (int i = 0; i < (int)(3); i++) r = min(r, ((int)v[i].size()));
  printf("%d\n", r);
  for (int i = 0; i < (int)(r); i++) {
    for (int j = 0; j < (int)(3); j++) printf("%d ", v[j][i]);
    printf("\n");
  }
}
int main() {
  solve();
  return 0;
}
