#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> v;
  int n, c, t1 = 0, t2 = 0, t3 = 0, w, count = 0, count_w = 0;
  cin >> n;
  while (n--) {
    cin >> c;
    v.push_back(c);
    if (c == 1)
      t1++;
    else if (c == 2)
      t2++;
    else
      t3++;
  }
  if (t1 != 0 && t2 != 0 && t3 != 0) {
    w = min(min(t1, t2), t3);
    cout << w << endl;
    for (int i = 0; i < w; i++) {
      for (int a = 0; a < v.size(); a++) {
        if (v[a] == 1) {
          cout << a + 1 << endl;
          v[a] = 0;
          break;
        }
      }
      for (int b = 0; b < v.size(); b++) {
        if (v[b] == 2) {
          cout << b + 1 << endl;
          v[b] = 0;
          break;
        }
      }
      for (int c = 0; c < v.size(); c++) {
        if (v[c] == 3) {
          cout << c + 1 << endl;
          v[c] = 0;
          break;
        }
      }
    }
  } else
    cout << 0 << endl;
}
