#include <bits/stdc++.h>
using namespace std;
int n;
int arr[100005];
int ans[100005][3], alen;
struct node {
  int n, cnt;
  bool friend operator<(node a, node b) { return a.cnt < b.cnt; }
} n1, n2, n3;
priority_queue<node> qu;
int blen = 0;
int main() {
  scanf("%d", &n);
  int i, j;
  for (i = 0; i < n; i++) scanf("%d", arr + i);
  sort(arr, arr + n);
  n1.n = arr[0];
  n1.cnt = 1;
  for (i = 1; i < n; i++) {
    if (arr[i] == arr[i - 1])
      n1.cnt++;
    else {
      qu.push(n1);
      n1.cnt = 1;
      n1.n = arr[i];
    }
  }
  qu.push(n1);
  while (qu.size() > 2) {
    n1 = qu.top();
    qu.pop();
    n2 = qu.top();
    qu.pop();
    n3 = qu.top();
    qu.pop();
    ans[alen][0] = n1.n;
    ans[alen][1] = n2.n;
    ans[alen][2] = n3.n;
    sort(ans[alen], ans[alen] + 3);
    alen++;
    n1.cnt--;
    n2.cnt--;
    n3.cnt--;
    if (n1.cnt != 0) qu.push(n1);
    if (n2.cnt != 0) qu.push(n2);
    if (n3.cnt != 0) qu.push(n3);
  }
  printf("%d\n", alen);
  for (i = 0; i < alen; i++) {
    for (j = 2; j > 0; j--) printf("%d ", ans[i][j]);
    printf("%d\n", ans[i][0]);
  }
  return 0;
}
