Skip to main content
LIVE CONTEST: Round #7 · Begin Marathon is live now! …

~/algor $ cat problems/minmax/smallest-and-largest-number

Smallest and largest number

Author Iqbolshoh Ilhomjonov 3 @iqbolshoh 650 problems
Easy 1000 ms 256 MB 20%
Share

A positive integer and a sequence of integers are given. Find the smallest and the largest number of the sequence.

Finding the smallest and the largest values of a sequence

Input

The first line contains an integer . The next line contains integers .

Output

One line with two integers separated by a space: the smallest and the largest.

Note


Examples

Input #1
5
3 1 7 2 5
Output #1
1 7
Input #2
4
-5 0 -12 8
Output #2
-12 8

Sign in to submit a solution

Signing up is free and takes a minute.