#include <bits/stdc++.h>
using namespace std;
int main() {
  (ios_base::sync_with_stdio(false), cin.tie(NULL));
  ;
  int n;
  cin >> n;
  int arr[n], o = 0, t = 0, h = 0;
  vector<int> v1;
  vector<int> v2;
  vector<int> v3;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] == 1) {
      o++;
      v1.push_back(i + 1);
    }
    if (arr[i] == 2) {
      h++;
      v2.push_back(i + 1);
    }
    if (arr[i] == 3) {
      t++;
      v3.push_back(i + 1);
    }
  }
  int min1 = min(o, min(t, h));
  cout << min1 << endl;
  for (int i = 0; i < min1; i++) {
    cout << v1[i] << " " << v2[i] << " " << v3[i] << endl;
  }
  return 0;
}
