#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(0);
  long long int n, j, coding = 0, math = 0, pe = 0;
  cin >> n;
  long long int a[n], b[n], i, team;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b, b + n);
  for (i = 0; i < n; i++) {
    if (b[i] == 1) {
      coding++;
    }
    if (b[i] == 2) {
      math++;
    }
    if (b[i] == 3) {
      pe++;
    }
  }
  team = min(coding, math);
  team = min(team, pe);
  cout << team << "\n";
  if (team != 0) {
    for (i = 0; i < team; i++) {
      for (j = 0; j < n; j++) {
        if (a[j] == 1) {
          a[j] = 0;
          cout << j + 1 << " ";
          break;
        }
      }
      for (j = 0; j < n; j++) {
        if (a[j] == 2) {
          a[j] = 0;
          cout << j + 1 << " ";
          break;
        }
      }
      for (j = 0; j < n; j++) {
        if (a[j] == 3) {
          a[j] = 0;
          cout << j + 1 << " ";
          break;
        }
      }
      cout << "\n";
    }
  }
  return 0;
}
