#T790. 最大跨度值

最大跨度值

Description

Given a sequence of non-negative integers of length n, calculate 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 the n non-negative integers of the sequence, each no greater than 1000, separated by a single space.

Output Format

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

6
3 0 8 7 5 9
9

Source

CodesOnline