Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/minmax-21-qiymatlar-oraligi

Range of values

Easy 1000 ms 128 MB 20%
Share

A positive integer $N$ and a sequence of $N$ integers are given. Find the difference between the largest and the smallest numbers of the sequence.

The difference between the largest and the smallest numbers of a sequence

Input

The first line contains a positive integer $N$. The next line contains $N$ integers $A_{i}$.

Output

One integer — the difference between the largest and the smallest numbers.

Note

$1 \le N \le 1000$
$-10^{9} \le A_{i} \le 10^{9}$

Examples

Input #1
5
3 9 1 7 4
Output #1
8
Input #2
1
-6
Output #2
0

Sign in to submit a solution

Signing up is free and takes a minute.