#include <bits/stdc++.h>
using namespace std;
void display(vector<int> v1) {
  for (int i = 0; i < v1.size(); i++) {
    cout << v1[i] << " ";
  }
  cout << endl;
}
int dx[8] = {0, 1, 0, -1, 1, 1, -1, -1};
int dy[8] = {1, 0, -1, 0, 1, -1, 1, -1};
using namespace std;
map<int, int> m1;
int n;
const int MAXN = (int)1e6;
vector<int> ans[MAXN];
priority_queue<pair<int, int> > q1;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; i += 1) {
    int x;
    cin >> x;
    m1[x] += 1;
  }
  for (auto itr : m1) {
    q1.push({itr.second, itr.first});
  }
  int cntr = 0;
  while (q1.size() >= 3) {
    cntr += 1;
    pair<int, int> wow = q1.top();
    q1.pop();
    pair<int, int> wow2 = q1.top();
    q1.pop();
    pair<int, int> wow3 = q1.top();
    q1.pop();
    ans[cntr].push_back(wow.second);
    ans[cntr].push_back(wow2.second);
    ans[cntr].push_back(wow3.second);
    if (wow.first > 1) {
      q1.push({wow.first - 1, wow.second});
    }
    if (wow2.first > 1) {
      q1.push({wow2.first - 1, wow2.second});
    }
    if (wow3.first > 1) {
      q1.push({wow3.first - 1, wow3.second});
    }
  }
  cout << cntr << endl;
  for (int i = 1; i <= cntr; i += 1) {
    sort(ans[i].begin(), ans[i].end());
    reverse(ans[i].begin(), ans[i].end());
    for (auto itr : ans[i]) {
      cout << itr << " ";
    }
    cout << endl;
  }
  return 0;
}
