#include <bits/stdc++.h>
using namespace std;
const int maxn = 100010;
int a[maxn];
int p[3];
int n;
vector<int> num[maxn];
vector<int> ans[3];
map<int, int> nu;
int c[3];
int tmp[3];
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    nu[a[i]] += 1;
  }
  for (int i = 0; i < n; ++i)
    if (nu[a[i]]) {
      num[nu[a[i]]].push_back(a[i]);
      nu[a[i]] = 0;
    }
  for (int i = 0; i < 3; ++i) {
    for (int j = 0; j < n; ++j)
      if (num[j].size()) p[i] = j;
    if (p[i] != 0) {
      tmp[i] = num[p[i]].back();
      num[p[i]].pop_back();
    }
  }
  while (p[2] > 0) {
    ans[2].push_back(tmp[2]);
    num[p[2] - 1].push_back(tmp[2]);
    ans[1].push_back(tmp[1]);
    num[p[1] - 1].push_back(tmp[1]);
    ans[0].push_back(tmp[0]);
    num[p[0] - 1].push_back(tmp[0]);
    for (int i = 0; i < 3; ++i) {
      while (!num[p[i]].size() && p[i]) p[i]--;
      if (p[i]) {
        tmp[i] = num[p[i]].back();
        num[p[i]].pop_back();
      }
    }
  }
  cout << ans[0].size() << endl;
  for (int i = 0; i < ans[0].size(); ++i) {
    c[0] = ans[0][i];
    c[1] = ans[1][i];
    c[2] = ans[2][i];
    sort(c, c + 3);
    cout << c[2] << " " << c[1] << " " << c[0] << endl;
  }
  return 0;
}
