#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, i, k1, k2, k3, m;
  k1 = k2 = k3 = m = 0;
  cin >> n;
  int a[n], a1[n], a2[n], a3[n];
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 1)
      a1[k1++] = i + 1;
    else if (a[i] == 2)
      a2[k2++] = i + 1;
    else
      a3[k3++] = i + 1;
  }
  m = min(k1, min(k2, k3));
  cout << m << endl;
  for (i = 0; i < m; i++) {
    cout << a1[i] << " " << a2[i] << " " << a3[i] << endl;
  }
  return 0;
}
