#include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[]) {
  int n;
  vector<int> p, m, pe;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    if (temp == 1) {
      p.push_back(i + 1);
    } else if (temp == 2) {
      m.push_back(i + 1);
    } else
      pe.push_back(i + 1);
  }
  int teams = min(min(p.size(), pe.size()), m.size());
  cout << teams << endl;
  for (int i = 0; i < teams; i++) {
    cout << p[i] << " " << pe[i] << " " << m[i] << endl;
  }
}
