#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, j, i, one = 0, two = 0, three = 0, jeta, gk = 1, tui = 0, koi[10000];
  cin >> n;
  int T[n];
  for (i = 0; i < n; i++) {
    cin >> T[i];
    if (T[i] == 1) one++;
    if (T[i] == 2) two++;
    if (T[i] == 3) three++;
  }
  jeta = min(min(one, two), three);
  if (one == 0 || two == 0 || three == 0)
    cout << 0;
  else {
    cout << jeta << endl;
    for (i = 0; i < n; i++) {
      for (j = 0; j < n; j++) {
        if (T[j] == gk) {
          koi[tui++] = j + 1;
          gk++;
          if (gk > 3) gk = 1;
          T[j] = 0;
          break;
        }
      }
    }
    for (i = 0; i < jeta * 3; i++) {
      cout << koi[i] << " ";
      if ((i + 1) % 3 == 0) cout << endl;
    }
  }
}
