#include <bits/stdc++.h>
using namespace std;
void FastIO() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.precision(20);
}
int main() {
  FastIO();
  int N;
  int A;
  cin >> N;
  int one[10000], two[10000], three[10000];
  int j = 0, k = 0, l = 0;
  for (int i = 1; i <= N; i++) {
    cin >> A;
    if (A == 1)
      one[j++] = i;
    else if (A == 2)
      two[k++] = i;
    else if (A == 3)
      three[l++] = i;
  }
  int ans = min(min(j, k), l);
  cout << ans << endl;
  for (int i = 0; i < ans; i++) {
    cout << one[i] << " " << two[i] << " " << three[i] << endl;
  }
  return 0;
}
