#include <bits/stdc++.h>
using namespace std;
const int SIZE = 128, MAXKETA = 8;
struct State {
  int cnt, len;
};
bool operator<(const State& a, const State& b) { return a.cnt < b.cnt; }
int main() {
  int n;
  while (cin >> n) {
    vector<int> r;
    map<int, int> ct;
    for (int i = 0; i < n; i++) {
      int rr;
      cin >> rr;
      r.push_back(rr);
      ct[rr]++;
    }
    priority_queue<State> vec;
    sort(r.begin(), r.end());
    for (int i = 0; i < n; i++)
      if (i == 0 || r[i] != r[i - 1]) vec.push((State){ct[r[i]], r[i]});
    vector<vector<int> > ans;
    while (1) {
      vector<int> a;
      vector<State> k;
      while (!vec.empty()) {
        State b = vec.top();
        vec.pop();
        a.push_back(b.len);
        b.cnt--;
        if (b.cnt != 0) k.push_back(b);
        if (a.size() == 3) break;
      }
      for (int i = 0; i < k.size(); i++)
        if (k[i].cnt != 0) vec.push(k[i]);
      if (a.size() < 3) break;
      sort(a.begin(), a.end());
      ans.push_back(a);
    }
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++) {
      cout << ans[i][2] << " " << ans[i][1] << " " << ans[i][0] << endl;
    }
  }
  return 0;
}
