#include <bits/stdc++.h>
using namespace std;
void speedUP() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  speedUP();
  int n;
  cin >> n;
  vector<int> one;
  vector<int> two;
  vector<int> three;
  for (int i = 1; i <= n; i++) {
    int temp;
    cin >> temp;
    if (temp == 1) {
      one.push_back(i);
    } else if (temp == 2) {
      two.push_back(i);
    } else {
      three.push_back(i);
    }
  }
  unsigned long teams = min({one.size(), two.size(), three.size()});
  if (!teams) {
    cout << teams;
    return 0;
  } else
    cout << teams << '\n';
  for (int i = 0; i < teams; i++) {
    cout << one[i] << " " << two[i] << " " << three[i] << '\n';
  }
}
