#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, m;
  cin >> n;
  vector<int> v1, v2, v3;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a == 1) {
      v1.push_back(i + 1);
    } else if (a == 2) {
      v2.push_back(i + 1);
    } else {
      v3.push_back(i + 1);
    }
  }
  int a1 = v1.size();
  int a2 = v2.size();
  int a3 = v3.size();
  m = min(a1, min(a2, a3));
  cout << m << endl;
  for (int i = 0; i < m; i++) {
    cout << v1[i] << " " << v2[i] << " " << v3[i] << endl;
  }
  return 0;
}
