#include <bits/stdc++.h>
using namespace std;
int n, i, v1[100001], v2[100001], v3[100001], k, k2, k3, x;
int main() {
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> x;
    if (x == 1) v1[++k] = i;
    if (x == 2) v2[++k2] = i;
    if (x == 3) v3[++k3] = i;
  }
  k = min(k, k2);
  k = min(k, k3);
  cout << k << "\n";
  for (i = 1; i <= k; i++) {
    cout << v1[i] << " " << v2[i] << " " << v3[i] << "\n";
  }
  return 0;
}
