Question
The Trident Equilibrium

A furniture factory manufactures stools using three metal rods. Each rod has a signed weight offset from a reference standard. For a stool to be perfectly balanced, the three rods chosen must have weight offsets that sum to exactly zero.

Given an array of weight offsets, find all unique triplets of rods whose offsets sum to zero. No two triplets in your answer may use the same rod at the same position (no duplicate triplets in the output, even if the input has repeated values).

Input

The first line contains KaTeX can only parse string typed expression. The second line contains KaTeX can only parse string typed expression space-separated integers.

Output

The first line contains the count of unique triplets. Each following line contains three space-separated integers representing one triplet, in non-decreasing order.

Example
Example 1:
Input
6

-1 0 1 2 -1 -4
Output
2

-1 -1 2
-1 0 1

Example 2:
Input
3

0 0 0
Output
1

0 0 0

Online