#P5724. Extreme Range
Extreme Range
Extreme Range
Given an integer n and n integers ai, calculate the range defined as the difference between the maximum and minimum values. Mathematically, the range is given by:
\(\text{range} = \max(a_i) - \min(a_i)\)
inputFormat
The first line contains an integer \(n\) (where \(1 \le n \le 10^5\)). The second line contains \(n\) space-separated integers \(a_i\).
outputFormat
Output a single integer representing the range of the given numbers.
sample
5
-1 0 1 2 3
4