#include <bits/stdc++.h>
using namespace std;
const string NAME = "GRESNOW";
const int N = 202020;
int n, m, k, x;
struct ball {
  int a, b, c;
};
map<int, int> cnt;
priority_queue<pair<int, int> > hf;
vector<ball> man;
int main() {
  ios::sync_with_stdio(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> x;
    cnt[x]++;
  }
  for (auto it : cnt) hf.push({it.second, it.first});
  while (hf.size() > 2) {
    vector<pair<int, int> > now;
    for (int i = 1; i <= 3; i++) {
      now.push_back({hf.top().second, hf.top().first});
      hf.pop();
    }
    for (int i = 0; i <= 2; i++)
      if (now[i].second - 1 > 0) hf.push({now[i].second - 1, now[i].first});
    sort(now.begin(), now.end(), greater<pair<int, int> >());
    man.push_back((ball){now[0].first, now[1].first, now[2].first});
  }
  cout << man.size() << "\n";
  for (auto x : man) cout << x.a << " " << x.b << " " << x.c << "\n";
  return 0;
}
