#K83562. Maximum Product Pair

    ID: 36225 Type: Default 1000ms 256MiB

Maximum Product Pair

Maximum Product Pair

You are given an array of n unique integers. Your task is to find the maximum product formed by multiplying two distinct elements from the array. In other words, if the array is denoted by \(A = [a_1, a_2, \dots, a_n]\), then you need to compute:

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

This problem requires you to consider both positive and negative integers because the product of two negative numbers can be positive and may result in a larger product than that of two positive numbers.

Note: The array will always have at least two elements.

inputFormat

The input is provided via standard input (stdin) and has the following format:

  • The first line contains a single integer n (\(n \ge 2\)) representing the number of elements in the array.
  • The second line contains n space-separated integers representing the elements of the array.

outputFormat

The output is a single line with one integer: the maximum product obtained by multiplying any two different elements of the array. The result should be printed to standard output (stdout).

## sample
5
1 2 3 4 5
20

</p>