#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int ara[n], flag[n];
  for (int i = 0; i < n; i++) {
    flag[i] = 0;
    cin >> ara[i];
  }
  int c1 = 0, c2 = 0, c3 = 0;
  for (int i = 0; i < n; i++) {
    if (ara[i] == 1)
      c1++;
    else if (ara[i] == 2)
      c2++;
    else
      c3++;
  }
  int ans;
  ans = min(c1, c2);
  ans = min(ans, c3);
  if (ans != 0) {
    cout << ans << endl;
    vector<int> v;
    for (int i = 0; i < ans; i++) {
      for (int j = 1; j <= 3; j++) {
        for (int k = 0; k < n; k++) {
          if (ara[k] == j && flag[k] == 0) {
            v.push_back(k + 1);
            flag[k] = 1;
            break;
          }
        }
      }
      for (int l = 0; l < 3; l++) cout << v[l] << " ";
      cout << endl;
      v.clear();
    }
  } else {
    cout << ans << endl;
  }
}
