#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
int n;
cin >> n;
vector<int> arr1, arr2, arr3;
for (int i = 1; i <= n; i++){
int a; cin >> a;
if (a == 1) arr1.push_back(i);
else if (a == 2) arr2.push_back(i);
else arr3.push_back(i);
}
int mx = min({arr1.size(), arr2.size(), arr3.size()});
cout << mx << endl;
for (int i = 0; i < mx; i++){
cout << arr1[i] << ' ' << arr2[i] << ' ' << arr3[i] << endl;
}
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgbGwgbG9uZyBsb25nCmludCBtYWluKCkKewogICAgaW50IG47CiAgICBjaW4gPj4gbjsKICAgIHZlY3RvcjxpbnQ+IGFycjEsIGFycjIsIGFycjM7CiAgICBmb3IgKGludCBpID0gMTsgaSA8PSBuOyBpKyspewogICAgICAgIGludCBhOyBjaW4gPj4gYTsKICAgICAgICBpZiAoYSA9PSAxKSBhcnIxLnB1c2hfYmFjayhpKTsKICAgICAgICBlbHNlIGlmIChhID09IDIpIGFycjIucHVzaF9iYWNrKGkpOwogICAgICAgIGVsc2UgYXJyMy5wdXNoX2JhY2soaSk7CiAgICB9CiAgICBpbnQgbXggPSBtaW4oe2FycjEuc2l6ZSgpLCBhcnIyLnNpemUoKSwgYXJyMy5zaXplKCl9KTsKICAgIGNvdXQgPDwgbXggPDwgZW5kbDsKICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbXg7IGkrKyl7CiAgICAgICAgY291dCA8PCBhcnIxW2ldIDw8ICcgJyA8PCBhcnIyW2ldIDw8ICcgJyA8PCBhcnIzW2ldIDw8IGVuZGw7CiAgICB9Cn0K