#include <bits/stdc++.h>
using namespace std;
int Count(int arr[], int n, int size) {
  int c = 0;
  for (int i = 0; i < size; i++) {
    if (arr[i] == n) c++;
  }
  return c;
}
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  int w = min(Count(arr, 1, n), Count(arr, 2, n));
  int j = min(w, Count(arr, 3, n));
  cout << j << endl;
  while (j-- > 0) {
    for (int i = 0; i < n; i++) {
      if (arr[i] == 1) {
        cout << i + 1 << " ";
        arr[i] = 0;
        break;
      }
    }
    for (int i = 0; i < n; i++) {
      if (arr[i] == 2) {
        cout << i + 1 << " ";
        arr[i] = 0;
        break;
      }
    }
    for (int i = 0; i < n; i++) {
      if (arr[i] == 3) {
        cout << i + 1 << " ";
        arr[i] = 0;
        break;
      }
    }
    cout << "\n";
  }
}
