#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100000 + 10;
const int MOD = 1e9 + 7;
int n;
vector<int> a, b, c;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 0; i < n; i++) {
    int f;
    cin >> f;
    if (f == 1) a.push_back(i + 1);
    if (f == 2) b.push_back(i + 1);
    if (f == 3) c.push_back(i + 1);
  }
  int k = min(a.size(), min(b.size(), c.size()));
  cout << k << endl;
  for (int i = 0; i < k; i++) {
    cout << a[i] << " " << b[i] << " " << c[i] << endl;
  }
}
