#include <iostream>
#include <queue>
#include <map>
using namespace std;
struct ball
{
int r, num;
bool operator<(const ball other) const
{
if(num!=other.num) return num>other.num;
else return r>other.r;
}
} balls[10001];
struct snowman
{
int big, middle, small;
} snowmans[3340];
int nobals, nosms;
int main()
{
int n;
cin >> n;
map<int, int> fuball;
for (int i = 0; i < n; i++)
{
int r;
cin >> r;
fuball[r]++;
}
for (auto &it : fuball)
{
balls[nobals].r = it.first;
balls[nobals].num = it.second;
nobals++;
}
priority_queue<ball> bl;
for (int i = 0; i < nobals; i++)
{
bl.push(balls[i]);
}
while (bl.size()>=3)
{
ball a, b, c;
a = bl.top();
bl.pop();
b = bl.top();
bl.pop();
c = bl.top();
bl.pop();
int ai, bi, ci;
ai = a.r;
bi = b.r;
ci = c.r;
a.num--;
b.num--;
c.num--;
if(a.num>0) bl.push(a);
if(b.num>0) bl.push(b);
if(c.num>0) bl.push(c);
if(ai<=bi) swap(ai,bi);
if(ai<=ci) swap(ai,ci);
if(bi<=ci) swap(bi,ci);
snowmans[nosms].big=ai;
snowmans[nosms].middle=bi;
snowmans[nosms].small=ci;
nosms++;
}
cout<<nosms<<endl;
for(int i=0;i<nosms;i++){
cout<<snowmans[i].big<<" "<<snowmans[i].middle<<" "<<snowmans[i].small<<endl;
}
return 0;
}
73行,相信你一定能明白