#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  queue<int> q1, q2, q3;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int x;
    cin >> x;
    if (x == 1) q1.push(i);
    if (x == 2) q2.push(i);
    if (x == 3) q3.push(i);
  }
  cout << min(q1.size(), min(q2.size(), q3.size())) << "\n";
  while (!q1.empty() && !q2.empty() && !q3.empty()) {
    cout << q1.front() << " " << q2.front() << " " << q3.front() << "\n";
    q1.pop();
    q2.pop();
    q3.pop();
  }
  return 0;
}
