#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  int n, temp;
  scanf("%d", &n);
  map<int, vector<int> > teams;
  vector<int> cnt(4, 0);
  for (int i = (int)(0); i < (int)(n); i++) {
    scanf("%d", &temp);
    ++cnt[temp];
    teams[temp].push_back(i + 1);
  }
  int mn = min(min(cnt[1], cnt[2]), cnt[3]);
  printf("%d ", mn);
  while (mn--) {
    printf("\n%d %d %d", teams[1].back(), teams[2].back(), teams[3].back());
    teams[1].pop_back();
    teams[2].pop_back();
    teams[3].pop_back();
  }
  return 0;
}
