#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  ;
  int n;
  cin >> n;
  int arr[n];
  vector<int> vec1, vec2, vec3, one, two, three;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  for (int i = 0; i < n; i++) {
    if (arr[i] == 1) {
      vec1.push_back(arr[i]);
      one.push_back(i + 1);
    } else if (arr[i] == 2) {
      vec2.push_back(arr[i]);
      two.push_back(i + 1);
    } else if (arr[i] == 3) {
      vec3.push_back(arr[i]);
      three.push_back(i + 1);
    }
  }
  auto it = min(min(vec1.size(), vec2.size()), vec3.size());
  cout << it << endl;
  for (int i = 0; i < it; i++) {
    cout << one[i] << " " << two[i] << " " << three[i] << endl;
  }
  cout << endl;
}
