#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t1 = 0, t2 = 0, t3 = 0, a;
  cin >> n;
  vector<int> v1;
  vector<int> v2;
  vector<int> v3;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    if (a == 1) {
      t1++;
      v1.push_back(i);
    } else if (a == 2) {
      t2++;
      v2.push_back(i);
    } else if (a == 3) {
      t3++;
      v3.push_back(i);
    }
  }
  int test = min(min(t1, t2), t3);
  if (test == 0) {
    cout << 0;
    return 0;
  }
  cout << test << endl;
  for (int i = 0; i < test; i++) {
    cout << v1[i] << " " << v2[i] << " " << v3[i] << endl;
  }
  return 0;
}
