#include <bits/stdc++.h>
using namespace std;
int min(int a, int b, int c) {
  if (a <= b && a <= c)
    return a;
  else if (b <= c && b <= a)
    return b;
  else
    return c;
}
int main() {
  int n, i, x, *a, *b, *c, k = 0, l = 0, m = 0;
  cin >> n;
  a = new int[n];
  b = new int[n];
  c = new int[n];
  for (i = 1; i <= n; i++) {
    cin >> x;
    if (x == 1) {
      a[k] = i;
      k++;
    } else if (x == 2) {
      b[l] = i;
      l++;
    } else {
      c[m] = i;
      m++;
    }
  }
  cout << min(k, l, m) << endl;
  for (i = 0; i < min(k, l, m); i++)
    cout << a[i] << " " << b[i] << " " << c[i] << endl;
  return 0;
}
