#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
map<int, int> mp;
map<int, int>::iterator it;
priority_queue<pair<int, int> > q;
struct Node {
  int x[3];
  Node(int t, int y, int z) {
    x[0] = t;
    x[1] = y;
    x[2] = z;
  }
};
vector<Node> ans;
int main() {
  int n;
  scanf("%d", &n);
  mp.clear();
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    mp[x]++;
  }
  for (it = mp.begin(); it != mp.end(); it++) {
    q.push(make_pair(it->second, it->first));
  }
  while (q.size() >= 3) {
    pair<int, int> x[3];
    for (int i = 0; i < 3; i++) {
      x[i] = q.top();
      q.pop();
    }
    ans.push_back(Node(x[0].second, x[1].second, x[2].second));
    for (int i = 0; i < 3; i++) {
      if (--x[i].first) {
        q.push(x[i]);
      }
    }
  }
  cout << ans.size() << endl;
  for (int i = 0; i < ans.size(); i++) {
    sort(ans[i].x, ans[i].x + 3);
    cout << ans[i].x[2] << ' ' << ans[i].x[1] << ' ' << ans[i].x[0] << endl;
  }
  return 0;
}
