#include <bits/stdc++.h>
using namespace std;
map<int, int> m;
int main() {
  int n;
  scanf("%d", &n);
  vector<int> v(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &v[i]);
    m[v[i]]++;
  }
  priority_queue<pair<int, int> > pq;
  for (map<int, int>::iterator it = m.begin(); it != m.end(); ++it)
    pq.push(make_pair(it->second, it->first));
  vector<vector<int> > res;
  while (pq.size() > 2) {
    pair<int, int> a = pq.top();
    pq.pop();
    pair<int, int> b = pq.top();
    pq.pop();
    pair<int, int> c = pq.top();
    pq.pop();
    vector<int> tmp;
    tmp.push_back(a.second);
    tmp.push_back(b.second);
    tmp.push_back(c.second);
    sort(tmp.rbegin(), tmp.rend());
    res.push_back(tmp);
    if (--a.first) pq.push(a);
    if (--b.first) pq.push(b);
    if (--c.first) pq.push(c);
  }
  printf("%d\n", res.size());
  for (int i = 0; i < res.size(); ++i) {
    for (int j = 0; j < 3; ++j) printf("%d ", res[i][j]);
    printf("\n");
  }
  return 0;
}
