Time limit
2s
Memory limit
256 MB
You are given N sticks. You want to choose some of them and connect them to make a rectangle.
Sticks may be connected end to end, but a stick cannot be cut. It is allowed to leave some sticks unused. The two opposite sides of the rectangle must have equal lengths.
Find the largest possible area of a rectangle that can be made. If no rectangle can be made, output -1.
The first line contains the number of sticks N. N is a natural number with 4 <= N <= 16.
The second line contains the stick lengths separated by spaces. Each stick length is a natural number not greater than 10.
Print the largest possible rectangle area on the first line. If it is impossible to make a rectangle with the given sticks, print -1.