P5724 [Shenji 4.Ex 5] Range / Maximum Span / Difference Between the Maximum and Minimum Values

Description

Given $n$ and $n$ integers $a_i$, find the range of these $n$ integers. The range means the difference between the maximum value and the minimum value in a set of numbers.

Input Format

The first line contains a positive integer $n$, indicating the number of integers. The second line contains $n$ integers $a_1, a_2 \dots a_n$, separated by spaces.

Output Format

Output an integer, representing the range of these $n$ integers.

Explanation/Hint

Constraints: $1 \leq n \leq 100$, $0 \le a_i \le 1000$. Translated by ChatGPT 5