#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) cin >> arr[i];
  int one = 0, two = 0, three = 0;
  for (int i = 0; i < n; i++) {
    if (arr[i] == 1) one++;
    if (arr[i] == 2) two++;
    if (arr[i] == 3) three++;
  }
  int mn = min(one, min(two, three));
  if (mn == 0)
    cout << mn;
  else {
    cout << mn << endl;
    while (mn > 0) {
      int count = 0;
      while (count != 3) {
        for (int i = 0; i < n; i++) {
          if (arr[i] == 1 && count == 0) {
            cout << i + 1 << " ";
            arr[i] = 0;
            count++;
            ;
          }
          if (arr[i] == 2 && count == 1) {
            cout << i + 1 << " ";
            arr[i] = 0;
            count++;
          }
          if (arr[i] == 3 && count == 2) {
            cout << i + 1 << " ";
            arr[i] = 0;
            count++;
          }
        }
      }
      cout << endl;
      mn--;
    }
  }
  return 0;
}
