#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, ones = 0, twos = 0, threes = 0, minn = 0, j = 0, k = 1;
  cin >> n;
  int t[n];
  for (i = 0; i < n; i++) {
    cin >> t[i];
    if (t[i] == 1)
      ones++;
    else if (t[i] == 2)
      twos++;
    else if (t[i] == 3)
      threes++;
  }
  if (ones <= twos && ones <= threes)
    minn = ones;
  else if (twos <= ones && twos <= threes)
    minn = twos;
  else
    minn = threes;
  cout << minn << endl;
  for (i = 0; i < minn; i++) {
    k = 1;
    for (j = 0; j < n && k != 4; j++) {
      if (t[j] == k) {
        cout << j + 1 << " ";
        t[j] = 0;
        k++;
        j = -1;
      }
    }
    cout << "\n";
  }
  return 0;
}
