#include<iostream>
#include<map>
#include<queue>
using namespace std;
const int N = 1e5 + 5;
priority_queue<pair<int, int> >q;
int a[N];
map<int, int>m;
int p[N][3];
void solve(){
int n;
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a[i];
m[a[i]]++;
}
map<int, int>::iterator it1;
for(it1 = m.begin(); it1 != m.end(); ++it1){
pair<int, int>x;
x.first = it1->first;
x.second = it1->second;
q.push(x);
}
int ans = 0;
while(q.size() >= 3){
pair<int, int> x = q.top();
q.pop();
pair<int, int> y = q.top();
q.pop();
pair<int, int> z = q.top();
q.pop();
p[++ans][0] = x.first, p[ans][1] = y.first, p[ans][2] = z.first;
if(x.second > 1) q.push({x.first, x.second - 1});
if(y.second > 1) q.push({y.first, y.second - 1});
if(z.second > 1) q.push({z.first, z.second - 1});
}
cout << ans << '\n';
for(int i = 1; i <= ans; i++) cout << p[i][0] << ' ' << p[i][1] << ' ' << p[i][2] << '\n';
}
int main(){
int t = 1;
while(t--){
solve();
}
return 0;
}