#include <bits/stdc++.h>
using namespace std;
int n, m, mm;
int a[100004];
int b[100004];
int c[100004];
bool check(int k) {
  int br = 1;
  m = 1;
  b[0] = a[0];
  for (int i = 1; i < n; i++) {
    if (a[i] == a[i - 1]) {
      br++;
      if (br <= k) b[m++] = a[i];
    } else {
      br = 1;
      b[m++] = a[i];
    }
  }
  if (m >= 3 * k) {
    mm = m;
    for (int i = 0; i < mm; i++) c[i] = b[i];
    return true;
  } else
    return false;
}
void printans(int k) {
  for (int i = 0; i < mm / 3; i++) {
    cout << c[i + 2 * k] << ' ' << c[i + k] << ' ' << c[i] << endl;
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  int l = 1, r = n / 3;
  int mid, res = 0;
  do {
    mid = (l + r) / 2;
    if (check(mid)) {
      res = mid;
      l = mid + 1;
    } else
      r = mid - 1;
  } while (l <= r);
  if (res == 0) {
    cout << 0 << endl;
    return 0;
  } else {
    cout << res << endl;
    printans(res);
  }
  return 0;
}
