#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int count1 = 0;
  int count2 = 0;
  int count3 = 0;
  vector<int> one, two, three;
  for (int i = 0; i < n; i++) {
    int temp;
    cin >> temp;
    if (temp == 1) {
      count1++;
      one.push_back(i + 1);
    } else if (temp == 2) {
      count2++;
      two.push_back(i + 1);
    } else {
      count3++;
      three.push_back(i + 1);
    }
  }
  int x = 0;
  int ans = min(count1, min(count2, count3));
  cout << ans << endl;
  while (ans--) {
    cout << one[x] << " " << two[x] << " " << three[x] << endl;
    x++;
  }
  return 0;
}
