#C11684. Maximum and Minimum Running Distance

    ID: 41027 Type: Default 1000ms 256MiB

Maximum and Minimum Running Distance

Maximum and Minimum Running Distance

You are given the number of days \(N\) and a list of distances run on each day. Your task is to determine the maximum and minimum distances from the provided list.

Input: The first line contains a single integer \(N\) representing the number of days. The second line contains \(N\) space-separated integers, where each integer represents the distance run on that day.

Output: Output two integers: the maximum distance followed by the minimum distance, separated by a space.

For example, if \(N = 5\) and the distances are [10, 5, 8, 12, 7], the output should be "12 5".

inputFormat

The input is given via stdin in the following format:

  • The first line contains an integer \(N\), the number of days.
  • The second line contains \(N\) space-separated integers representing the distances run each day.

outputFormat

Output two integers on a single line: the maximum distance and the minimum distance, separated by a space, printed to stdout.

## sample
5
10 5 8 12 7
12 5

</p>