#include <bits/stdc++.h>
const int inf = 1e9 + 7;
const long long int INF = 1e18;
const double pi = 2 * acos(0);
int64_t gcd(int64_t a, int64_t b) { return b == 0 ? a : gcd(b, a % b); }
int64_t lcm(int64_t a, int64_t b) { return a / gcd(a, b) * b; }
int64_t mod_pow(int64_t a, int64_t b, int64_t m) {
  if (b == 0) return 1;
  if (b & 1) return a * mod_pow(a, b - 1, m) % m;
  return mod_pow(a * a % m, b >> 1, m);
}
bool is_prime(int64_t x) {
  if (x <= 3) return x >= 2;
  if (x % 2 == 0) return false;
  for (int64_t d = 3; d * d <= x; d += 2) {
    if (x % d == 0) return false;
  }
  return true;
}
void solve(std::string& s) {
  int n = s.length();
  int i = 0, j = n - 1;
  int ans = 0;
  while (i < j) {
    if (s[i] == s[j]) {
      ++i;
      --j;
    } else {
      ++i;
      ++ans;
    }
  }
  std::cout << (ans % 2 == 0 ? "First" : "Second");
}
int arr[10010];
int n, m;
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  std::cout.tie(nullptr);
  std::cin >> n;
  std::map<int, std::vector<int>> d;
  std::map<int, int> dd;
  for (int i = 0; i < n; ++i) {
    std::cin >> arr[i];
    ++dd[arr[i]];
    d[arr[i]].push_back(i + 1);
  }
  int teams = std::min(dd[1], std::min(dd[2], dd[3]));
  std::cout << teams << "\n";
  for (int i = 0; i < teams; ++i) {
    for (auto it : d) {
      std::cout << it.second[i] << " ";
    }
    std::cout << "\n";
  }
}
