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