#include <bits/stdc++.h>
using namespace std;
map<int, int> mp;
int n, ans[100001][4], cnt = 0;
pair<int, int> t[4];
priority_queue<pair<int, int> > q;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    ++mp[x];
  }
  for (map<int, int>::iterator it = mp.begin(); it != mp.end(); it++) {
    q.push({it->second, it->first});
  }
  while (q.size() >= 3) {
    ++cnt;
    for (int i = 1; i <= 3; i++) {
      t[i] = q.top();
      q.pop();
      ans[cnt][i] = t[i].second;
    }
    for (int i = 1; i <= 3; i++) {
      t[i].first--;
      if (t[i].first) {
        q.push(t[i]);
      }
    }
  }
  cout << cnt << "\n";
  for (int i = 1; i <= cnt; i++) {
    sort(ans[i] + 1, ans[i] + 4);
    cout << ans[i][3] << " " << ans[i][2] << " " << ans[i][1] << "\n";
  }
}
