#include <bits/stdc++.h>
using namespace std;
int In[100007];
struct Node {
  int v, c;
  Node() {}
  Node(int _v, int _c) { v = _v, c = _c; }
};
bool operator<(Node a, Node b) { return a.c < b.c; }
priority_queue<Node> PQ;
vector<vector<int> > ans;
int main() {
  int N;
  cin >> N;
  int i, j;
  for (i = 0; i < (N); i++) cin >> In[i];
  sort(In, In + N);
  int c = 1;
  for (i = (1); i <= (N - 1); i++) {
    if (In[i] == In[i - 1])
      c++;
    else {
      PQ.push(Node(In[i - 1], c));
      c = 1;
    }
  }
  PQ.push(Node(In[i - 1], c));
  Node u1, u2, u3;
  while (((int)(PQ).size()) > 2) {
    vector<int> vec;
    u1 = PQ.top();
    vec.push_back(u1.v);
    u1.c--;
    PQ.pop();
    u2 = PQ.top();
    vec.push_back(u2.v);
    u2.c--;
    PQ.pop();
    u3 = PQ.top();
    vec.push_back(u3.v);
    u3.c--;
    PQ.pop();
    if (u1.c) PQ.push(u1);
    if (u2.c) PQ.push(u2);
    if (u3.c) PQ.push(u3);
    sort((vec).begin(), (vec).end());
    reverse((vec).begin(), (vec).end());
    ans.push_back(vec);
  }
  cout << ((int)(ans).size()) << endl;
  for (i = 0; i < (((int)(ans).size())); i++) {
    for (j = 0; j < (((int)(ans[i]).size())); j++) {
      if (j) cout << " ";
      cout << ans[i][j];
    }
    cout << endl;
  }
  return 0;
}
