#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return (b == 0) ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) {
  long long x = (a / gcd(a, b)) * b;
  return x;
}
int main() {
  cin.sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long t, n, x, y, z, m, a, b;
  cin >> t;
  long long arr[t + 10], br[4];
  set<long long> ss;
  int cn1 = 0, cn2 = 0, cn3 = 0;
  vector<pair<long long, long long>> vect1;
  vector<pair<long long, long long>> vect2;
  vector<pair<long long, long long>> vect3;
  for (long long i = 0; i < t; i++) {
    cin >> arr[i];
    z = arr[i];
    ss.insert(arr[i]);
    if (arr[i] == 1) {
      vect1.push_back(make_pair(1, i));
      cn1++;
    } else if (arr[i] == 2) {
      vect2.push_back(make_pair(2, i));
      cn2++;
    } else {
      vect3.push_back(make_pair(3, i));
      cn3++;
    }
  }
  if (ss.size() < 3) {
    cout << "0" << '\n';
  } else {
    x = min(cn1, min(cn2, cn3));
    cout << x << '\n';
    for (long long k = 0; k < x; k++) {
      cout << vect1[k].second + 1 << " ";
      cout << vect2[k].second + 1 << " ";
      cout << vect3[k].second + 1 << " ";
      cout << '\n';
    }
  }
  return 0;
}
