#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int b[3];
  b[0] = 0;
  b[1] = 0;
  b[2] = 0;
  for (int i = 0; i < n; i++) {
    b[a[i] - 1]++;
  }
  sort(b, b + 3);
  cout << b[0] << endl;
  ;
  for (int i = 0; i < b[0]; i++) {
    for (int j = 0; j < n; j++) {
      if (a[j] == 1) {
        cout << j + 1 << " ";
        a[j] = 0;
        break;
      }
    }
    for (int j = 0; j < n; j++) {
      if (a[j] == 2) {
        cout << j + 1 << " ";
        a[j] = 0;
        break;
      }
    }
    for (int j = 0; j < n; j++) {
      if (a[j] == 3) {
        cout << j + 1 << " ";
        a[j] = 0;
        break;
      }
    }
    cout << endl;
  }
}
