#include <bits/stdc++.h>
using namespace std;
int n, i, k, x;
string s;
stack<int> s1, s2, s3;
int main() {
  cin >> n;
  for (k = 1; k <= n; k++) {
    cin >> i;
    if (i == 1) s1.push(k);
    if (i == 2) s2.push(k);
    if (i == 3) s3.push(k);
  }
  x = min(min(s1.size(), s2.size()), s3.size());
  cout << x << endl;
  for (k = 0; k < x; k++) {
    cout << s1.top() << " ";
    s1.pop();
    cout << s2.top() << " ";
    s2.pop();
    cout << s3.top() << endl;
    s3.pop();
  }
}
