#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  int n, x;
  vector<int> a, b, c;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x == 1)
      a.push_back(i + 1);
    else if (x == 2)
      b.push_back(i + 1);
    else
      c.push_back(i + 1);
  }
  int res = min({a.size(), b.size(), c.size()});
  cout << res << endl;
  for (int i = 0; i < res; i++) {
    cout << a[i] << " " << b[i] << " " << c[i] << endl;
  }
  return 0;
}
