#C8617. Maximum Product of Two Distinct Elements

    ID: 52619 Type: Default 1000ms 256MiB

Maximum Product of Two Distinct Elements

Maximum Product of Two Distinct Elements

You are given an array of n integers. The task is to find the maximum product obtainable by multiplying any two distinct elements from the array.

Mathematically, if the array is \(a_1, a_2, \dots, a_n\), you need to compute:

\( \max_{1 \le i < j \le n} (a_i \times a_j) \)

It is guaranteed that n \ge 2.

inputFormat

The input is given via stdin with the following format:

  1. The first line contains a single integer n, the number of elements.
  2. The second line contains n space-separated integers representing the elements of the array.

outputFormat

Output a single integer representing the maximum product of any two distinct elements in the array. The result should be printed to stdout.

## sample
4
1 2 3 4
12

</p>