#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, e, i, one = 0, two = 0, three = 0, x;
  cin >> n;
  int a1[n], a2[n], a3[n];
  for (i = 1; i <= n; i++) {
    cin >> e;
    if (e == 1) {
      one++;
      a1[one] = i;
    } else if (e == 2) {
      two++;
      a2[two] = i;
    } else {
      three++;
      a3[three] = i;
    }
  }
  x = min(one, two);
  x = min(x, three);
  if (one >= 1 && two >= 1 && three >= 1) {
    cout << x << endl;
    for (i = 1; i <= x; i++) {
      cout << a1[i] << " " << a2[i] << " " << a3[i] << endl;
    }
  } else {
    cout << 0;
  }
  return 0;
}
