#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a = 0, b = 0, c = 0, ans = 0, index1 = 0, index2 = 0, index3 = 0;
  cin >> n;
  int arr[n], aa[n], bb[n], cc[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] == 1)
      a++, aa[index1++] = i + 1;
    else if (arr[i] == 2)
      b++, bb[index2++] = i + 1;
    else
      c++, cc[index3++] = i + 1;
  }
  cout << min(a, min(b, c)) << endl;
  for (int i = 0; i < min(a, min(b, c)); i++) {
    cout << aa[i] << " " << bb[i] << " " << cc[i] << endl;
  }
}
