#include <bits/stdc++.h>
using namespace std;
int n;
int v[112345];
int temp[3][112345];
bool solve(int x) {
  int stage = 0;
  int q = 0;
  for (int i = 0; i < n; ++i) {
    if (stage == 0 || v[i] > temp[stage - 1][q]) {
      temp[stage][q] = v[i];
      ++q;
      if (q == x) {
        ++stage;
        q = 0;
      }
    }
    if (stage == 3) return true;
  }
  return false;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) scanf("%d", v + i);
  sort(v, v + n);
  int l = 0, r = n;
  while (l + 1 < r) {
    int mid = (l + r) >> 1;
    if (solve(mid))
      l = mid;
    else
      r = mid;
  }
  cout << l << endl;
  solve(l);
  for (int i = 0; i < l; ++i) {
    for (int j = 2; j >= 0; --j) {
      printf("%d%c", temp[j][i], " \n"[j == 0]);
    }
  }
  return 0;
}
