#include <bits/stdc++.h>
using namespace std;
int i, n, k, W, a;
int main() {
  vector<int> A;
  vector<int> B;
  vector<int> C;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a;
    if (a == 1) A.push_back(i);
    if (a == 2) B.push_back(i);
    if (a == 3) C.push_back(i);
  }
  W = min(min(A.size(), B.size()), C.size());
  cout << W << endl;
  for (k = 0; k < W; k++)
    cout << A[k] + 1 << " " << B[k] + 1 << " " << C[k] + 1 << " " << endl;
}
