#include <bits/stdc++.h>
using namespace std;
void read() {}
int n;
map<int, int> mp;
vector<pair<pair<int, int>, int> > ans;
void build(int k) {
  vector<int> v(3 * k);
  int cnt = 0;
  for (map<int, int>::iterator it = mp.begin(); it != mp.end(); it++) {
    int l = min(it->second, k);
    for (int i = 0; i < l; i++) v[cnt++] = (it->first);
  }
  printf("%d\n", k);
  for (int i = 0; i < k; i++) {
    printf("%d %d %d\n", v[i + 2 * k], v[i + k], v[i]);
  }
}
bool chk(int k) {
  int cnt = 0;
  for (map<int, int>::iterator it = mp.begin(); it != mp.end(); it++)
    cnt += min(it->second, k);
  if (cnt >= 3 * k) return 1;
  return 0;
}
int bs(int l, int h) {
  int mid = (l + h + 1) / 2;
  if (l >= h) return mid;
  if (chk(mid)) return bs(mid, h);
  return bs(l, mid - 1);
}
int main() {
  read();
  while (scanf("%d", &n) == 1) {
    int x;
    mp.clear();
    for (int i = 0; i < n; i++) {
      scanf("%d", &x);
      mp[x]++;
    }
    build(bs(0, n / 3));
  }
}
