Codeforces Round 100
C
New Year Snowmen
Codeforces
1800
原题
← BD →
翻译中…

As meticulous Gerald sets the table and caring Alexander sends the postcards, Sergey makes snowmen. Each showman should consist of three snowballs: a big one, a medium one and a small one. Sergey's twins help him: they've already made $*n*$ snowballs with radii equal to $*r*_{1}$, $*r*_{2}$, ..., $*r*_{*n*}$. To make a snowman, one needs any three snowballs whose radii are pairwise different. For example, the balls with radii $1$, $2$ and $3$ can be used to make a snowman but $2$, $2$, $3$ or $2$, $2$, $2$ cannot. Help Sergey and his twins to determine what maximum number of snowmen they can make from those snowballs.

翻译中…

Input

翻译中…

The first line contains integer $*n*$ ($1 ≤ *n* ≤ 10^{5}$) — the number of snowballs. The next line contains $*n*$ integers — the balls' radii $*r*_{1}$, $*r*_{2}$, ..., $*r*_{*n*}$ ($1 ≤ *r*_{*i*} ≤ 10^{9}$). The balls' radii can coincide.

翻译中…

Output

翻译中…

Print on the first line a single number $*k*$ — the maximum number of the snowmen. Next $*k*$ lines should contain the snowmen's descriptions. The description of each snowman should consist of three space-separated numbers — the big ball's radius, the medium ball's radius and the small ball's radius. It is allowed to print the snowmen in any order. If there are several solutions, print any of them.

翻译中…

样例

Input #1
7
1 2 3 4 5 6 7
Output #1
2
3 2 1
6 5 4
InputCopy OutputCopy
Input #2
3
2 2 3
Output #2
0
InputCopy OutputCopy
题目信息
题号
140C
时间限制
2 s
内存限制
256 MB
标签
二分
数据结构
贪心

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。