#C3130. Maximum Product of Two Numbers

    ID: 46524 Type: Default 1000ms 256MiB

Maximum Product of Two Numbers

Maximum Product of Two Numbers

Given a list of integers, find the maximum product obtainable by multiplying any two distinct numbers from the list. Note that the list may include both positive and negative integers, as well as zero. The maximum product can be achieved either by multiplying the two largest numbers or by multiplying the two smallest (most negative) numbers.

For example, for the input [1, 2, 3], the correct answer is 6, while for the input [-10, -10, 5, 2], the correct answer is 100.

inputFormat

The first line of input contains a single integer n (n ≥ 2) representing the number of elements in the list. The second line contains n space-separated integers.

outputFormat

Output a single integer — the maximum product of any two distinct numbers from the list.

## sample
3
1 2 3
6