#include <bits/stdc++.h>
using namespace std;
int n, a[100005], tot;
map<int, int> mp;
struct nod {
  int shu, siz;
  bool operator<(const nod &x) const { return siz < x.siz; }
} b[100005];
priority_queue<nod> q;
int ans, ball[100005][5];
signed main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    if (mp[a[i]] == 0) {
      tot++;
      mp[a[i]] = tot;
      b[tot].siz++;
      b[tot].shu = a[i];
    } else
      b[mp[a[i]]].siz++;
  }
  for (int i = 1; i <= tot; ++i) q.push(b[i]);
  nod r[5];
  while (q.size() >= 3) {
    r[1] = q.top(), q.pop();
    r[2] = q.top(), q.pop();
    r[3] = q.top(), q.pop();
    ans++;
    for (int i = 1; i <= 3; ++i) {
      ball[ans][i] = -r[i].shu;
      r[i].siz--;
      if (r[i].siz) q.push(r[i]);
    }
  }
  cout << ans << '\n';
  for (int i = 1; i <= ans; ++i) {
    sort(ball[i] + 1, ball[i] + 4);
    for (int j = 1; j <= 3; ++j) cout << -ball[i][j] << ' ';
    cout << '\n';
  }
  return 0;
}
