#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> v1, v2, v3;
  int i = 1;
  while (n--) {
    int a;
    cin >> a;
    if (a == 1)
      v1.push_back(i);
    else if (a == 2)
      v2.push_back(i);
    else
      v3.push_back(i);
    i++;
  }
  int a, b, c;
  a = v1.size();
  b = v2.size();
  c = v3.size();
  int mn = min(a, b);
  mn = min(mn, c);
  cout << mn << endl;
  for (int i = 0; i < mn; i++) {
    cout << v1[i] << " " << v2[i] << " " << v3[i] << endl;
  }
  return 0;
}
