#include <bits/stdc++.h>
using namespace std;
const long long M = 5005;
const int MOD = 998244353;
const int MX = 3e5 + 5;
const long long INF = 1e18;
const long double PI = acos((long double)-1);
void msm() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
}
int sol();
int main() {
  msm();
  sol();
  return 0;
}
int sol() {
  long long n;
  cin >> n;
  ;
  long long ar[105], arr[105][5005];
  for (long long i = (0); i < (n); ++i) {
    long long a;
    cin >> a;
    ;
    ar[a]++;
    arr[a][ar[a]] = i + 1;
  }
  long long y = min(ar[1], min(ar[2], ar[3]));
  cout << y << endl;
  for (long long i = (1); i <= (y); ++i)
    cout << arr[1][i] << " " << arr[2][i] << " " << arr[3][i] << endl;
  return 0;
}
