#include <bits/stdc++.h>
using namespace std;
int n, k, l, i, j, a, b, a1, a2, b1, b2, c1, c2, d[100005][3], res;
map<int, int> m;
priority_queue<pair<int, int> > q;
int main() {
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> a;
    m[a]++;
  }
  for (map<int, int>::iterator it = m.begin(); it != m.end(); it++)
    q.push({it->second, it->first});
  while (q.size() >= 3) {
    a1 = q.top().first - 1;
    a2 = q.top().second;
    q.pop();
    b1 = q.top().first - 1;
    b2 = q.top().second;
    q.pop();
    c1 = q.top().first - 1;
    c2 = q.top().second;
    q.pop();
    if (a1 > 0) q.push({a1, a2});
    if (b1 > 0) q.push({b1, b2});
    if (c1 > 0) q.push({c1, c2});
    d[res][0] = a2;
    d[res][1] = b2;
    d[res][2] = c2;
    sort(d[res], d[res] + 3);
    reverse(d[res], d[res] + 3);
    res++;
  }
  cout << res << endl;
  for (i = 0; i < res; i++)
    cout << d[i][0] << " " << d[i][1] << " " << d[i][2] << endl;
}
