#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, ones = 0, twos = 0, threes = 0;
  cin >> n;
  vector<int> v;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &x);
    v.push_back(x);
    if (x == 1)
      ones++;
    else if (x == 2)
      twos++;
    else
      threes++;
  }
  int lower_bound = min({ones, twos, threes});
  if (lower_bound == 0) {
    cout << 0;
    return 0;
  }
  cout << lower_bound << "\n";
  bool flag1 = true, flag2 = true, flag3 = true;
  for (int i = 0; i < lower_bound; ++i) {
    for (int j = 0; j < n; ++j) {
      if (v[j] == 1 && flag1) {
        cout << j + 1 << " ";
        v[j] = -1;
        flag1 = false;
      } else if (v[j] == 2 && flag2) {
        cout << j + 1 << " ";
        v[j] = -1;
        flag2 = false;
      } else if (v[j] == 3 && flag3) {
        cout << j + 1 << " ";
        v[j] = -1;
        flag3 = false;
      }
    }
    cout << "\n";
    flag1 = true;
    flag2 = true;
    flag3 = true;
  }
  return 0;
}
