DMOPC '19 Contest 1 P0 - Range Finding

View as PDF

Submit solution


Points: 3
Time limit: 3.0s
Memory limit: 64M
Java 128M
Python 128M

Author:
Problem type

You are given N numbers, a_1, a_2, \ldots , a_N. Output the range of this list. The range of a list of numbers is the difference between the largest and smallest values in this list.

Constraints

In all tests,
1 \le N \le 1 \space 000 \space 000
-10^9 \le a_i \le 10^9

Input Specifications

The first line contains one number, N.
The second line contains N spaced integers, a_i, the numbers in this list.

Output Specifications

On one line, output the range of the N numbers.

Sample Input

10
9 2 9 6 8 7 1 3 9 6

Sample Output

8

Comments

There are no comments at the moment.