#include<stdio.h>
#include<algorithm>
#include<queue>
#include<string.h>
using namespace std;
int num[100005];
struct node
{
int shu,inde;
bool operator <(const node &u)const
{
return shu<u.shu;
}
}book;
struct node2
{
int x,y,z;
}ans[100005];
int cmp(node a ,node b)
{
return a.shu>b.shu;
}
int main()
{
int t;
int n,i,j,re;
priority_queue<node>q;
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&num[i]);
sort(num,num+n);
book.shu=0;
for(j=0,i=0;i<n-1;i++)
{
book.shu++;
book.inde=num[i];
if(num[i]!=num[i+1])
{
q.push(book);
book.shu=0;
}
}
if(num[n-1]==num[n-2])
{
book.shu++;
q.push(book);
}
else
{
book.shu++;
book.inde=num[n-1];
q.push(book);
}
// while(!q.empty())
// {
// book=q.top();
// q.pop();
// printf("%d %d\n",book.inde,book.shu);
// }
j=0;
node a,b,c;
while(!q.empty())
{
a=q.top();
q.pop();
if(q.empty())
break;
b=q.top();
q.pop();
if(q.empty())
break;
c=q.top();
q.pop();
ans[j].x=a.inde;
ans[j].y=b.inde;
ans[j].z=c.inde;
j++;
a.shu--;
b.shu--;
c.shu--;
if(a.shu>0)
q.push(a);
if(b.shu>0)
q.push(b);
if(c.shu>0)
q.push(c);
}
printf("%d\n",j);
int x1,x2,x3;
for(i=0;i<j;i++)
{
if(ans[i].x>ans[i].y)
{
x1=ans[i].x;
x2=ans[i].y;
}
else
{
x1=ans[i].y;
x2=ans[i].x;
}
if(ans[i].z>x1)
{
printf("%d %d %d\n",ans[i].z,x1,x2);
}
else if(ans[i].z<x2)
{
printf("%d %d %d\n",x1,x2,ans[i].z);
}
else
{
printf("%d %d %d\n",x1,ans[i].z,x2);
}
}
return 0;
}