#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, temp, a[4][100005 / 3 + 1];
  map<int, int> Map;
  map<int, int>::iterator it;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> temp;
    Map[temp]++;
  }
  long long int hi = n / 3 + 1, lo = 0;
  while (lo < hi) {
    long long int mid = (hi + lo + 1) / 2;
    long long int X = 0;
    for (it = Map.begin(); it != Map.end(); it++) {
      if (it->second < mid) {
        X += it->second;
      } else {
        X += mid;
      }
    }
    if (X >= 3 * mid)
      lo = mid;
    else
      hi = mid - 1;
  }
  cout << hi << endl;
  if (hi == 0) return 0;
  it = Map.end();
  it--;
  int cnt = 0;
  for (int r = 1; r <= 3; r++) {
    for (int c = 1; c <= hi; c++) {
      a[r][c] = it->first;
      it->second--;
      cnt++;
      if (it->second == 0 || (cnt == hi)) {
        it--;
        cnt = 0;
      }
    }
  }
  for (int c = 1; c <= hi; c++) {
    for (int r = 1; r <= 3; r++) {
      cout << a[r][c] << " ";
    }
    cout << endl;
  }
  return 0;
}
