#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, n1 = 0, n2 = 0, n3 = 0, min, i;
  cin >> n;
  int a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 1) n1++;
    if (a[i] == 2) n2++;
    if (a[i] == 3) n3++;
  }
  if (n1 <= n2 && n1 <= n3)
    min = n1;
  else if (n2 <= n1 && n2 <= n3)
    min = n2;
  else
    min = n3;
  cout << min << endl;
  int x[min];
  int y[min];
  int z[min];
  n1 = 0;
  n2 = 0;
  n3 = 0;
  for (i = 0; i < n; i++) {
    if (a[i] == 1) {
      if (n1 == min) continue;
      x[n1] = i + 1;
      n1++;
    }
    if (a[i] == 2) {
      if (n2 == min) continue;
      y[n2] = i + 1;
      n2++;
    }
    if (a[i] == 3) {
      if (n3 == min) continue;
      z[n3] = i + 1;
      n3++;
    }
  }
  for (i = 0; i < min; i++) {
    cout << x[i] << " " << y[i] << " " << z[i];
    cout << endl;
  }
}
