#include <bits/stdc++.h>
const int maxn = 1e5 + 10;
int n, r[maxn];
struct Node {
  int s, c;
} b[maxn];
int tot;
inline bool f() {
  for (int i = 1; i <= tot; ++i) {
    int a = b[i].c - n / 3;
    if (a > 0) {
      b[i].c -= a;
      n -= a;
      return true;
    }
  }
  return false;
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", &r[i]);
  }
  std::sort(r + 1, r + 1 + n);
  for (int i = 1; i <= n; ++i) {
    if (i == 1 || r[i] != r[i - 1]) {
      b[++tot].s = r[i];
      b[tot].c = 1;
    } else {
      ++b[tot].c;
    }
  }
  while (f())
    ;
  printf("%d\n", n / 3);
  static int w;
  static int tmp[maxn];
  for (int i = 1; i <= tot; ++i) {
    while (b[i].c--) {
      tmp[++w] = b[i].s;
    }
  }
  w /= 3;
  for (int i = 1; i <= w; ++i) {
    printf("%d %d %d\n", tmp[w * 2 + i], tmp[w + i], tmp[i]);
  }
}
