AT_icpc2016autumn_a Best Matched Pair

Description

给定 $n(1\le n\le 1000)$ 个互不相同的正整数 $a_i(1\le a_i\le10^4)$。现在求 $a_i\times a_j(i\ne j)$ 的最大值。 这个乘积需要保证从高到低的对应数字依次递增且连续,如:$1234$ 是合法的,$4321$ 与 $1245$ 都是不合法的。

Input Format

第一行一个正整数 $n$。 接下来一行共 $n$ 个正整数 $a_i$。

Output Format

输出最大的符合要求的乘积。如果没有,输出 `-1`。 **特别的,对于本题,您应该在行末输出一个换行,否则评测机会返回 `WA`。**

Explanation/Hint

Translate by @[tianbiandeshenghuo11](/user/752485)