#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int count_1 = 0, count_2 = 0, count_3 = 0;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] == 1) {
      count_1++;
    }
    if (arr[i] == 2) {
      count_2++;
    }
    if (arr[i] == 3) {
      count_3++;
    }
  }
  int Min = min(count_1, count_2);
  int group = min(Min, count_3);
  cout << group << "\n";
  int i = 0;
  while (group--) {
    while (arr[i] != 1 && i < n) {
      i++;
    }
    cout << i + 1 << " ";
    arr[i] = 0;
    i = 0;
    while (arr[i] != 2 && i < n) {
      i++;
    }
    cout << i + 1 << " ";
    arr[i] = 0;
    i = 0;
    while (arr[i] != 3 && i < n) {
      i++;
    }
    cout << i + 1 << "\n";
    arr[i] = 0;
    i = 0;
  }
}
