#include <bits/stdc++.h>
using namespace std;
int main() {
  list<int> list1, list2, list3;
  list<int>::iterator k, k2, k3;
  int n, temp, count = 0, count2 = 0, count3 = 0, i;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> temp;
    switch (temp) {
      case 1: {
        count++;
        list1.push_back(i + 1);
        break;
      }
      case 2: {
        count2++;
        list2.push_back(i + 1);
        break;
      }
      case 3: {
        count3++;
        list3.push_back(i + 1);
        break;
      }
    }
  }
  temp = count < count2 ? count : count2;
  temp = temp < count3 ? temp : count3;
  if (temp == 0) {
    cout << "0";
  } else {
    k = list1.begin();
    k2 = list2.begin();
    k3 = list3.begin();
    cout << temp << endl;
    for (i = 0; i < temp; i++) {
      cout << *k << " " << *k2 << " " << *k3 << " " << endl;
      k++;
      k2++;
      k3++;
    }
  }
  return 0;
}
