#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> vec1, vec2, vec3;
  int n, sz;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    if (x == 1)
      vec1.push_back(i);
    else if (x == 2)
      vec2.push_back(i);
    else
      vec3.push_back(i);
  }
  sz = min(min(vec1.size(), vec2.size()), vec3.size());
  cout << sz << endl;
  for (int i = 0; i < sz; ++i)
    cout << vec1[i] << " " << vec2[i] << " " << vec3[i] << endl;
  return 0;
}
