#include <bits/stdc++.h>
using namespace std;
bool comp(int a, int b) { return (a < b); }
int main() {
  int n, i, k, i1 = 0, i2 = 0, i3 = 0, n1, n2, n3, mem;
  cin >> n;
  int a[n], b[n], x1[n], x2[n], x3[n];
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  for (i = 0; i < n; i++) b[i] = i + 1;
  n1 = count(a, a + n, 1);
  n2 = count(a, a + n, 2);
  n3 = count(a, a + n, 3);
  mem = min({n1, n2, n3}, comp);
  if (mem == 0)
    cout << mem << '\n';
  else {
    cout << mem << '\n';
    pair<int, int> p[n];
    for (i = 0; i < n; i++) {
      p[i].first = a[i];
      p[i].second = b[i];
    }
    sort(p, p + n);
    for (i = 1; i <= 3; i++) {
      for (k = 0; k < n; k++) {
        if (p[k].first == 1) {
          x1[i1++] = p[k].second;
          if (i1 == mem) break;
        }
        if (p[k].first == 2) {
          x2[i2++] = p[k].second;
          if (i2 == mem) break;
        }
        if (p[k].first == 3) {
          x3[i3++] = p[k].second;
          if (i3 == mem) break;
        }
      }
    }
    for (i = 0; i < mem; i++)
      cout << x1[i] << " " << x2[i] << " " << x3[i] << '\n';
    cout << '\n';
  }
  return 0;
}
