#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<vector<long long> > res;
  map<long long, long long> freq;
  for (long long i = 0; i < a.size(); i++) {
    freq[a[i]]++;
  }
  multiset<pair<long long, long long> > v;
  for (auto x : freq) {
    v.insert({x.second, x.first});
  }
  while (v.size() >= 3) {
    vector<long long> cur;
    auto it = v.end();
    it--;
    vector<pair<long long, long long> > temp;
    while (temp.size() < 3) {
      temp.push_back(*it);
      it--;
      cur.push_back(temp.back().second);
    }
    for (auto x : temp) {
      v.erase(v.find(x));
    }
    for (auto x : temp) {
      if (x.first - 1 > 0) v.insert({x.first - 1, x.second});
    }
    sort(cur.begin(), cur.end());
    reverse(cur.begin(), cur.end());
    res.push_back(cur);
  }
  cout << res.size() << '\n';
  for (auto x : res) {
    for (auto t : x) cout << t << " ";
    cout << '\n';
  }
  return 0;
}
