#include <bits/stdc++.h>
using namespace std;
bool comp(int x, int y) { return x > y; }
int n;
int temp;
map<int, int> m;
pair<int, int> arr[3];
priority_queue<pair<int, int> > pq;
vector<vector<int> > res;
int main() {
  while (cin >> n) {
    res.clear();
    m.clear();
    for (int i = 0; i < n; ++i) {
      cin >> temp;
      m[temp]++;
    }
    map<int, int>::iterator it;
    for (it = m.begin(); it != m.end(); it++) {
      pq.push(make_pair((*it).second, (*it).first));
    }
    while (pq.size() > 2) {
      vector<int> temp;
      for (int i = 0; i < 3; ++i) {
        arr[i] = pq.top();
        temp.push_back(arr[i].second);
        pq.pop();
      }
      sort(temp.begin(), temp.end(), comp);
      res.push_back(temp);
      for (int i = 0; i < 3; ++i) {
        arr[i].first--;
        if (arr[i].first) pq.push(arr[i]);
      }
    }
    cout << res.size() << '\n';
    for (int i = 0; i < res.size(); ++i) {
      cout << res[i][0];
      for (int j = 1; j < 3; ++j) cout << " " << res[i][j];
      cout << '\n';
    }
    while (!pq.empty()) pq.pop();
  }
  return 0;
}
