#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> t[4];
int max;
int main() {
  cin >> n;
  int x;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    t[x].push_back(i);
  }
  int res = min(t[1].size(), min(t[2].size(), t[3].size()));
  cout << res << endl;
  for (int i = 0; i < res; i++)
    cout << t[1][i] << " " << t[2][i] << " " << t[3][i] << endl;
  return 0;
}
