#include <bits/stdc++.h>
using namespace std;
int n, a[5001], cnt1, cnt2, cnt3, ans, i;
vector<int> v1;
vector<int> v2;
vector<int> v3;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] == 1) {
      cnt1++;
      v1.push_back(i + 1);
    } else if (a[i] == 2) {
      cnt2++;
      v2.push_back(i + 1);
    } else {
      cnt3++;
      v3.push_back(i + 1);
    }
  }
  ans = min(min(cnt1, cnt2), cnt3);
  cout << ans << endl;
  if (ans == 0) return 0;
  for (i = 0; i < ans; i++) {
    cout << v1[i] << " " << v2[i] << " " << v3[i] << " ";
    cout << endl;
  }
  return 0;
}
