#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  char t[n];
  for (int x = 0; x < n; x++) {
    cin >> t[x];
  }
  int one = 0, two = 0, three = 0;
  for (int x = 0; x < n; x++) {
    if (t[x] == '1') {
      one++;
    }
    if (t[x] == '2') {
      two++;
    }
    if (t[x] == '3') {
      three++;
    }
  }
  int ot = min(one, two);
  int minimum = min(ot, three);
  cout << minimum << endl;
  int m = -1, w = -1, q = -1;
  for (int x = 0; x < minimum; x++) {
    for (int o = m + 1; o < n; o++) {
      if (t[o] == '1') {
        cout << o + 1 << " ";
        m = o;
        break;
      }
    }
    for (int r = w + 1; r < n; r++) {
      if (t[r] == '2') {
        cout << r + 1 << " ";
        w = r;
        break;
      }
    }
    for (int h = q + 1; h < n; h++) {
      if (t[h] == '3') {
        cout << h + 1;
        q = h;
        break;
      }
    }
    cout << endl;
  }
  return 0;
}
