#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x;
  cin >> n;
  vector<int> V[4];
  for (int i = 0; i < n; i++) {
    cin >> x;
    V[x].push_back(i + 1);
  }
  int t = min(V[1].size(), min(V[2].size(), V[3].size()));
  cout << t << "\n";
  for (int i = 0; i < t; i++) {
    cout << V[1][i] << " " << V[2][i] << " " << V[3][i] << "\n";
  }
  return 0;
}
