Problem

14 /21


Sigma 2015

Problem

A long-term experiment is being conducted in the physics laboratory to study the Earth's gravitational field. Every minute a positive integer number – is transmitted to the laboratory via the communication channel. the current reading of the Sigma 2015 instrument. The number of transmitted numbers in the series is known and does not exceed 100,000. All numbers do not exceed 10,000. The time during which the transmission takes place can be neglected. You need to calculate the "beta value" a series of instrument readings – the minimum even product of two readings, between the moments of transmission of which at least 6 minutes have elapsed. If such a product cannot be obtained, the answer is considered to be -1.
 

Write a program to solve the given problem that is both time and memory efficient (or at least one of those characteristics).


Input 
The first line contains the number N – the total number of instrument readings. It is guaranteed that \(N>6\). Each of the following N lines specifies one positive integer – another reading of the device.

Output
The program should output one number - the product described in the condition, or -1 if such a product cannot be obtained.

 

Examples
# Input Output
1 12
45
5
3
1
7
23
21
20
19
18
1
7
18