#include <bits/stdc++.h>
using namespace std;
struct snow {
  friend bool operator<(snow a, snow b) { return a.count < b.count; }
  int num, count;
} S[100005];
int a[34000][3];
priority_queue<snow> Q;
int cmp(snow a, snow b) { return a.num < b.num; }
int cmpn(snow a, snow b) { return a.count > b.count; }
int cmpm(int a, int b) { return a > b; }
void CountNum(int n) {
  int i, j;
  for (i = 0, j = 1; j < n; j++) {
    if (S[j].num == S[i].num) {
      S[i].count++;
      S[j].count = 0;
    } else {
      Q.push(S[i]);
      i = j;
    }
  }
  Q.push(S[i]);
}
int main() {
  int n, i, j, m, ans, k, p, t;
  scanf("%d", &n);
  ans = 0;
  for (i = 0; i < n; i++) {
    scanf("%d", &S[i].num);
    S[i].count = 1;
  }
  sort(S, S + n, cmp);
  CountNum(n);
  sort(S, S + n, cmpn);
  snow temp1, temp2, temp3;
  p = 0;
  while (!Q.empty()) {
    temp1 = Q.top();
    a[p][0] = temp1.num;
    Q.pop();
    if (Q.empty()) break;
    temp2 = Q.top();
    a[p][1] = temp2.num;
    Q.pop();
    if (Q.empty()) break;
    temp3 = Q.top();
    a[p][2] = temp3.num;
    Q.pop();
    sort(a[p], a[p] + 3, cmpm);
    if (--temp1.count) Q.push(temp1);
    if (--temp2.count) Q.push(temp2);
    if (--temp3.count) Q.push(temp3);
    p++;
  }
  printf("%d\n", p);
  for (i = 0; i < p; i++) printf("%d %d %d\n", a[i][0], a[i][1], a[i][2]);
  return 0;
}
