#K65342. Maximum Product of Two Elements

    ID: 32176 Type: Default 1000ms 256MiB

Maximum Product of Two Elements

Maximum Product of Two Elements

Given an array of non-negative integers, your task is to find the maximum product of two distinct elements in the array. In other words, if the array is \(a_1, a_2, \ldots, a_N\), you are to compute

\(\max_{1 \leq i < j \leq N} (a_i \times a_j)\)

If the array contains fewer than two elements, then the maximum product is defined to be 0.

The input is provided via standard input (stdin) and the answer must be printed to standard output (stdout).

inputFormat

The first line of input contains a single integer \(N\) representing the number of elements in the array. The second line contains \(N\) space-separated integers representing the elements of the array.

outputFormat

Output the maximum product of two distinct elements in the array.

## sample
5
1 3 5 2 8
40