#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> indices1;
  vector<int> indices2;
  vector<int> indices3;
  for (int i = 0; i < n; i++) {
    int t;
    cin >> t;
    if (t == 1) indices1.push_back(i + 1);
    if (t == 2) indices2.push_back(i + 1);
    if (t == 3) indices3.push_back(i + 1);
  }
  int teams = min(indices1.size(), min(indices2.size(), indices3.size()));
  cout << teams << endl;
  for (int t = 0; t < teams; t++) {
    cout << indices1[t] << ' ' << indices2[t] << ' ' << indices3[t] << endl;
  }
  return 0;
}
