#C1725. Find the Minimum and Maximum

    ID: 44962 Type: Default 1000ms 256MiB

Find the Minimum and Maximum

Find the Minimum and Maximum

You are given an array of integers A. Your task is to determine the minimum and maximum elements of the array. Formally, if A is an array, you need to find \(\min(A)\) and \(\max(A)\).

The input will be read from standard input (stdin) and the output must be written to standard output (stdout). Ensure that your solution strictly follows the input/output format.

inputFormat

The input begins with an integer n, representing the number of integers in the array, followed by n space-separated integers.

Example: For an array of 6 elements, the input could be:

6 3 1 2 3 5 4

outputFormat

Output two integers separated by a space: the minimum and the maximum values in the array.

Example: For the above input, the correct output is:

1 5
## sample
6 3 1 2 3 5 4
1 5