#include <bits/stdc++.h>
using namespace std;
priority_queue<pair<int, int> > p;
vector<pair<int, int> > q;
vector<int> a, b;
vector<vector<int> > res;
int n;
int main() {
  scanf("%d", &n);
  for (int i = 0, x; i < n; i++) {
    scanf("%d", &x);
    a.push_back(x);
  }
  sort(a.begin(), a.end());
  for (int i = 0, c; i < n; i += c) {
    c = 0;
    while (i + c < n && a[i] == a[i + c]) c++;
    p.push({c, a[i]});
  }
  while (p.size() > 2) {
    q.clear();
    b.clear();
    for (int i = 0; i < 3; i++) {
      q.push_back(p.top());
      p.pop();
    }
    for (int i = 0; i < 3; i++) {
      b.push_back(q[i].second);
      q[i].first--;
      if (q[i].first > 0) p.push(q[i]);
    }
    sort(b.begin(), b.end());
    res.push_back(b);
  }
  printf("%d\n", res.size());
  for (int i = 0; i < res.size(); i++)
    for (int j = 2; j >= 0; j--) printf("%d%c", res[i][j], " \n"[j == 0]);
  return 0;
}
