cho.sh
Notes
Loading...

Making a Rectangle

Time limit

2s

Memory limit

256 MB

Problem

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.

Input

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.

Output

Print the largest possible rectangle area on the first line. If it is impossible to make a rectangle with the given sticks, print -1.