#C4942. Minimum Communication Range

    ID: 48536 Type: Default 1000ms 256MiB

Minimum Communication Range

Minimum Communication Range

You are given n friends, each with a walkie-talkie that has a certain communication range. In order for all friends to remain connected, the communication range used must be at least as large as the largest range available among them. In other words, if the ranges are given by \(a_1, a_2, \ldots, a_n\), then the minimum required communication range is:

\(r_{min} = \max\{a_1, a_2, \ldots, a_n\}\)

Your task is to compute \(r_{min}\) given the list of ranges.

inputFormat

The input is given via stdin and consists of two lines.

  • The first line contains a single integer \(n\) representing the number of friends (or walkie-talkies).
  • The second line contains \(n\) space-separated integers, where each integer \(a_i\) represents the communication range of the \(i^{th}\) walkie-talkie.

outputFormat

Output a single integer to stdout which is the minimum communication range required such that all friends remain connected. This is equivalent to the maximum number among the provided ranges.

## sample
5
5 3 6 2 4
6