#include <bits/stdc++.h>
const int N = 1e5 + 10;
using namespace std;
map<int, int> mp;
struct a {
  int x, y, z;
};
vector<a> res;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    int t;
    cin >> t;
    mp[t]++;
  }
  priority_queue<pair<int, int>> pq;
  for (auto it = mp.begin(); it != mp.end(); ++it) {
    int fi = it->second;
    int se = it->first;
    pq.push({fi, se});
  }
  while (pq.size() >= 3) {
    auto xx = pq.top();
    pq.pop();
    auto yy = pq.top();
    pq.pop();
    auto zz = pq.top();
    pq.pop();
    a temp;
    temp.x = xx.second;
    temp.y = yy.second;
    temp.z = zz.second;
    res.push_back(temp);
    if (xx.first - 1) {
      pq.push({xx.first - 1, xx.second});
    }
    if (yy.first - 1) {
      pq.push({yy.first - 1, yy.second});
    }
    if (zz.first - 1) {
      pq.push({zz.first - 1, zz.second});
    }
  }
  cout << res.size() << '\n';
  for (int i = 0; i < res.size(); ++i) {
    int b[3];
    b[0] = res[i].x;
    b[1] = res[i].y;
    b[2] = res[i].z;
    sort(b, b + 3);
    cout << b[2] << ' ' << b[1] << ' ' << b[0] << '\n';
  }
}
