#P5724. 【深基4.习5】求极差 / 最大跨度值 / 最大值和最小值的差

【深基4.习5】求极差 / 最大跨度值 / 最大值和最小值的差

Problem Description

Given nn and nn integers aia_i, find the range of these nn 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 nn, indicating the number of integers.

The second line contains nn integers a1,a2ana_1, a_2 \dots a_n, separated by spaces.

Output Format

Output an integer, representing the range of these nn integers.

6
4 1 5 1 4 1
4

Hint

Constraints: 1n1001 \leq n \leq 100, 0ai10000 \le a_i \le 1000.

Translated by ChatGPT 5