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