#include <bits/stdc++.h>
using namespace std;
void solve() {
  long long i, j, k, l, t, y, r, q, n1, x, test, n, z;
  cin >> n;
  long long a[100000];
  vector<long long> v[100000];
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < n; i++) {
    if (a[i] == 1)
      v[1].push_back(i + 1);
    else if (a[i] == 2)
      v[2].push_back(i + 1);
    else
      v[3].push_back(i + 1);
  }
  long long value = min(v[1].size(), min(v[2].size(), v[3].size()));
  i = 0;
  if (value == 0)
    cout << 0;
  else {
    cout << value << "\n";
    while (value--) {
      cout << v[1][i] << " " << v[2][i] << " " << v[3][i] << "\n";
      i++;
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  solve();
}
