#include <bits/stdc++.h>
using namespace std;
vector<int> f[110010 / 3];
bool check;
int n, x, i, k, j, d, conta, bho, a1, a2, a3, b1, b2, b3;
int s[110010];
priority_queue<pair<int, int> > pq;
struct bal {
  int p, num;
};
vector<bal> v;
bool acompare(bal i1, bal i2) { return (i1.p < i2.p); }
int main() {
  ifstream in("input.txt");
  cin >> n;
  for (i = 0; i < n; i++) {
    cin >> x;
    v.push_back({x, 1});
  }
  sort(v.begin(), v.end(), acompare);
  for (i = 1; i < n; i++) {
    while (v[i].p == v[i - 1].p && i < n) {
      v[i].num += v[i - 1].num;
      i++;
    }
  }
  for (i = n - 1; i >= 0; i -= v[i].num) {
    pq.push({v[i].num, v[i].p});
  }
  while (!pq.empty()) {
    a1 = pq.top().second;
    b1 = pq.top().first;
    pq.pop();
    if (pq.empty()) break;
    a2 = pq.top().second;
    b2 = pq.top().first;
    pq.pop();
    if (pq.empty()) break;
    a3 = pq.top().second;
    b3 = pq.top().first;
    pq.pop();
    f[conta].push_back(a1);
    f[conta].push_back(a2);
    f[conta].push_back(a3);
    b1--;
    if (b1) pq.push({b1, a1});
    b2--;
    if (b2) pq.push({b2, a2});
    b3--;
    if (b3) pq.push({b3, a3});
    conta++;
  }
  cout << conta << "\n";
  for (i = 0; i < conta; i++) {
    sort(f[i].begin(), f[i].end());
    for (j = 2; j >= 0; j--) cout << f[i][j] << " ";
    cout << "\n";
  }
}
