#include <bits/stdc++.h>
using namespace std;
int dx[] = {1, 0, -1, 0};
int dy[] = {0, 1, 0, -1};
const int N = (int)2e5 + 7;
const int MOD = (int)1e9 + 7;
const int INF = (int)2e7;
const long long BIG = 1e18;
int a[N], b[N], c[N], d[N];
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  int n, ans = 0;
  cin >> n;
  unordered_map<int, int> cnt;
  for (int i = 0; i < n; i++) cin >> a[i], cnt[a[i]]++;
  set<pair<int, int> > q;
  for (auto x : cnt) q.insert(make_pair(x.second, x.first));
  while (int(q.size()) >= 3) {
    vector<pair<int, int> > del;
    auto it = q.end();
    --it;
    b[ans] = it->second;
    del.push_back(*it);
    --it;
    c[ans] = it->second;
    del.push_back(*it);
    --it;
    d[ans] = it->second;
    del.push_back(*it);
    ++ans;
    for (auto x : del) {
      pair<int, int> w = x;
      q.erase(w);
      if (w.first != 1) q.insert(make_pair(w.first - 1, w.second));
    }
  }
  cout << ans << '\n';
  for (int i = 0; i < ans; i++) {
    vector<int> p = {b[i], c[i], d[i]};
    sort(p.begin(), p.end());
    cout << p[2] << ' ' << p[1] << ' ' << p[0] << '\n';
  }
  return 0;
}
