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