#Z14105. 最大跨度值

最大跨度值

Description

Given a non-negative integer sequence of length n, compute the maximum span value of the sequence (maximum span value = maximum value minus minimum value).

Input Format

There are two lines of input. The first line contains the number of elements in the sequence, n (1 ≤ n ≤ 1000). The second line contains n non-negative integers (each ≤ 1000) separated by single spaces.

Output Format

Output a single line representing the maximum span value of the sequence.

6
3 0 8 7 5 9


9