Minimum and Maximum

No attempts yetTime limit1sMemory limit256 MB

Problem

You are given NN integers. Write a program that finds the smallest and the largest of them.

Input

The first line contains the number of integers NN (1N1061 \le N \le 10^6).

The second line contains the NN integers, separated by spaces. Each integer is at least 106-10^6 and at most 10610^6.

Output

Print the smallest and the largest of the NN given integers on the first line, separated by a single space.