#t43. 求最大值与最小值

求最大值与最小值

Maximum and Minimum

Problem Description

Given n and n integers a_i, find the maximum and the minimum among these n integers.

Input Format

The first line contains a positive integer n, the number of integers.

The second line contains n integers a_1, a_2, …, a_n, separated by spaces.

Output Format

Output two integers separated by a space: the first is the maximum and the second is the minimum.

Sample Input

5
3 1 4 1 5

Sample Output

5 1

Constraints

1 ≤ n ≤ 10^5, 0 ≤ a_i ≤ 1000.