#K39357. Maximum and Minimum Difficulty Levels

    ID: 26402 Type: Default 1000ms 256MiB

Maximum and Minimum Difficulty Levels

Maximum and Minimum Difficulty Levels

You are given a list of difficulty levels for various tasks. Your task is to determine the maximum and minimum difficulty levels from the provided list.

The input begins with an integer n representing the number of levels. The next line contains n space-separated integers where each integer represents a difficulty level.

Your output should consist of two integers separated by a space: the first integer is the maximum difficulty level, and the second integer is the minimum difficulty level.

Note: The problem can be expressed using the following formulas in LaTeX:

\( max = \max_{1 \le i \le n}{levels[i]} \)

\( min = \min_{1 \le i \le n}{levels[i]} \)

inputFormat

The input is provided via standard input (stdin). It consists of two lines:

  • The first line contains a single integer n denoting the number of levels.
  • The second line contains n space-separated integers representing the difficulty levels.

outputFormat

Output the maximum and minimum difficulty levels as two space-separated integers on a single line, with the maximum printed first followed by the minimum.

The output should be written to standard output (stdout).

## sample
5
4 7 1 8 9
9 1