#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[10], i, n;
  memset(a, 0, sizeof a);
  cin >> n;
  vector<int> v[10];
  for (i = 0; i < 10; i++) v[i].clear();
  for (i = 1; i <= n; i++) {
    int x;
    cin >> x;
    a[x]++;
    v[x].push_back(i);
  }
  int num = min(min(a[1], a[2]), a[3]);
  cout << num << endl;
  if (num == 0) return 0;
  for (i = 0; i < num; i++) {
    cout << v[1][i] << " " << v[2][i] << " " << v[3][i] << endl;
  }
  return 0;
}
