#include <bits/stdc++.h>
using namespace std;
int num1[5010], num2[5010], num3[5010];
int main() {
  int n, i, t, sum, one, two, three, zuixiao;
  while (cin >> n) {
    one = two = three = sum = 0;
    for (i = 1; i <= n; i++) {
      cin >> t;
      if (t == 1) {
        num1[one] = i;
        one++;
      } else if (t == 2) {
        num2[two] = i;
        two++;
      } else if (t == 3) {
        num3[three] = i;
        three++;
      }
    }
    zuixiao = min(one, min(two, three));
    cout << zuixiao << endl;
    for (i = 0; i < zuixiao; i++) {
      cout << num1[i] << " " << num2[i] << " " << num3[i] << endl;
    }
  }
  return 0;
}
