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