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