Олимпиадный тренинг

Задача 42935. Gamma 2022


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 Gamma 2022 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 "gamma value" a series of instrument readings – the maximum even product of two readings, between the moments of transmission of which at least 10 minutes have passed. 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 > 10\). Each of the following N lines specifies one positive integer – another reading of the device.


Imprint
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 15
45
5
3
1
7
23
21
20
19
18
1
7
2
12
7
540