#C6118. Max-Min Product

    ID: 49843 Type: Default 1000ms 256MiB

Max-Min Product

Max-Min Product

You are given an array of integers, and your task is to compute the product of the maximum and minimum elements in the array. Formally, if \( M = \max(arr) \) and \( m = \min(arr) \), then you need to output \( M \times m \).

This problem tests your ability to process arrays and perform basic operations. Make sure your solution reads data from the standard input (stdin) and writes the result to the standard output (stdout).

inputFormat

The input begins with a single integer \( n \) which represents the number of elements in the array. The next line contains \( n \) space-separated integers representing the elements of the array.

Example:

5
3 5 1 9 2

outputFormat

Output a single integer which is the product of the maximum and minimum numbers in the array.

Example:

9
## sample
5
3 5 1 9 2
9