#include <bits/stdc++.h>
using namespace std;
struct point {
  int x, y, ind;
  char ch;
};
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long fact[13];
void factorial() {
  fact[0] = 1;
  for (long long i = 1; i < 12; i++) fact[i] = (fact[i - 1] * i);
}
bool cmp(point A, point B) {
  if (A.x != B.x) return A.x < B.x;
  return A.y < B.y;
}
vector<long long> sie;
long long spf[10000007 + 7];
void sieve() {
  for (long long i = 2; i < 10000007; i++) {
    if (spf[i] == 0) {
      spf[i] = i;
      sie.push_back(i);
    }
    for (long long j = 0; j < ((long long)(sie).size()) &&
                          i * sie[j] <= 10000007 && sie[j] <= spf[i];
         j++)
      spf[i * sie[j]] = sie[j];
  }
}
const long long mx = 100007;
long long n, ans, _1, _2, an, bigans, m, _, _3;
long long ar[mx], nr[mx], cover[mx];
priority_queue<pair<long long, long long> > ss;
map<long long, long long> mm;
vector<vector<long long> > anp;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << setprecision(12);
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> ar[i];
    mm[ar[i]]++;
  }
  for (auto a : mm) {
    ss.push({a.second, a.first});
  }
  while (ss.size() > 2) {
    pair<long long, long long> a, b, c;
    vector<long long> tmp;
    a = ss.top();
    ss.pop();
    b = ss.top();
    ss.pop();
    c = ss.top();
    ss.pop();
    tmp.push_back(a.second);
    tmp.push_back(b.second);
    tmp.push_back(c.second);
    sort((tmp).begin(), (tmp).end());
    a.first -= 1;
    b.first -= 1;
    c.first -= 1;
    if (a.first > 0) ss.push(a);
    if (b.first > 0) ss.push(b);
    if (c.first > 0) ss.push(c);
    anp.push_back(tmp);
  }
  cout << anp.size() << "\n";
  for (long long i = 0; i < ((long long)(anp).size()); i++) {
    cout << anp[i][2] << " ";
    cout << anp[i][1] << " ";
    cout << anp[i][0] << "\n";
  }
  return 0;
}
