#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  vector<int> a[4];
  int t;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> t;
    a[t].push_back(i);
  }
  int ans = min(min(a[3].size(), a[1].size()), a[2].size());
  cout << ans << endl;
  for (int i = 0; i < ans; i++) {
    cout << a[1][i] << " " << a[2][i] << " " << a[3][i] << endl;
  }
  return 0;
}
