#include <bits/stdc++.h>
using namespace std;
long long n, a[10004], mn, m;
map<long long, long long> mp;
vector<long long> c1;
vector<long long> c2;
vector<long long> c3;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    mp[a[i]]++;
    if (a[i] == 1) c1.push_back(i + 1);
    if (a[i] == 2) c2.push_back(i + 1);
    if (a[i] == 3) c3.push_back(i + 1);
  }
  if (mp[1] == 0 || mp[2] == 0 || mp[3] == 0)
    cout << 0;
  else {
    m = min(mp[1], mp[2]);
    mn = min(m, mp[3]);
    cout << mn << endl;
    for (int i = 0; i < mn; i++) {
      cout << c1[i] << " " << c2[i] << " " << c3[i] << endl;
    }
  }
  return 0;
}
