#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, j, k, l, n, ans;
  int a[40000][3];
  map<int, int> M;
  map<int, int>::iterator it;
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> j;
    M[j]++;
  }
  int L = 0, R = n / 3;
  while (L < R) {
    ans = (L + R + 1) / 2;
    int cnt = 0;
    for (it = M.begin(); it != M.end(); it++) cnt += min(it->second, ans);
    if (cnt >= 3 * ans)
      L = ans;
    else
      R = ans - 1;
  }
  ans = L;
  cout << ans << endl;
  i = 0;
  j = 0;
  for (it = M.begin(); it != M.end(); it++) {
    k = min(it->second, ans);
    while (k--) {
      a[i][j] = it->first;
      i++;
      if (i == ans) {
        j++;
        i = 0;
      }
      if (j == 3) break;
    }
    if (j == 3) break;
  }
  for (i = 0; i < ans; i++)
    cout << a[i][2] << " " << a[i][1] << " " << a[i][0] << endl;
  return 0;
}
