#K77827. Uniform Toll Booth Rate

    ID: 34951 Type: Default 1000ms 256MiB

Uniform Toll Booth Rate

Uniform Toll Booth Rate

You are given a sequence of toll rates at different booths. Your task is to find the maximum uniform toll X that can be charged at every booth such that

\(X \leq toll_i \quad \text{for all } i\)

This is equivalent to finding the minimum toll rate among the given booths:

[ X = \min_{1 \leq i \leq n} toll_i ]

If the list of toll rates is empty, then it is impossible to assign a uniform toll and you should output -1.

inputFormat

The first line of the input contains a non-negative integer n, which indicates the number of toll booths. If n > 0, the second line contains n space-separated integers representing the toll rates at each booth.

outputFormat

Output a single integer representing the maximum uniform toll that satisfies the condition. If no toll rates are provided (n=0), output -1.## sample

4
7 5 3 9
3

</p>