#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-9;
const int inf = 0x3f3f3f3f;
const int MAXN = 100004;
priority_queue<pair<int, int> > pq;
int a[MAXN], ans[MAXN][3];
map<int, int> mp;
int main() {
  int n, t = 0;
  scanf(" %d", &n);
  for (int i = 0; i < n; i++) {
    scanf(" %d", a + i);
    mp[a[i]]++;
  }
  for (auto m : mp) {
    int f, v;
    tie(v, f) = m;
    pq.push(pair<int, int>(f, v));
  }
  while (pq.size() >= 3) {
    pair<int, int> p = pq.top();
    pq.pop();
    pair<int, int> q = pq.top();
    pq.pop();
    pair<int, int> r = pq.top();
    pq.pop();
    ans[t][0] = p.second;
    ans[t][1] = q.second;
    ans[t][2] = r.second;
    t++;
    p.first--, q.first--, r.first--;
    if (p.first > 0) pq.push(p);
    if (q.first > 0) pq.push(q);
    if (r.first > 0) pq.push(r);
  }
  printf("%d\n", t);
  for (int i = 0; i < t; i++) {
    sort(ans[i], ans[i] + 3);
    printf("%d %d %d\n", ans[i][2], ans[i][1], ans[i][0]);
  }
}
