#t42. 求极差

求极差

Range of Numbers

Problem Description

Given nn and nn integers aia_i, compute the range of these nn integers. The range means the difference between the maximum and the minimum of a set of numbers.

Input Format

The first line contains a positive integer nn, the number of integers.

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

Output Format

Output one integer: the range of these nn integers.

Sample Input

6
4 1 5 1 4 1

Sample Output

4

Sample Explanation

The 66 input integers are 4,1,5,1,4,14, 1, 5, 1, 4, 1. The maximum is 55 and the minimum is 11, so the range is 5−1=45 - 1 = 4.

Constraints

1≤n≤1001 \le n \le 100, 0≤ai≤10000 \le a_i \le 1000.