H. Hlaalu's Ebony
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

Word has reached House Hlaalu of a merchant blessed with a satchel of Almsivi Intervention scrolls — the Tribunal's gift that lets one step instantly to the nearest temple anywhere on Vvardenfell. No longer bound to the silt strider's fixed path, the merchant may appear at any settlement, in any order, to trade raw ebony.

At each of the $$$N$$$ settlements, the price of raw ebony is known. The merchant will buy one unit at a settlement and sell it at a (possibly identical) settlement. Since travel order is unrestricted, the maximum profit is the largest selling price minus the smallest buying price. If all prices are equal, the answer is $$$0$$$.

Given the prices at all $$$N$$$ settlements, determine the maximum profit the merchant can achieve.

Input

The first line contains a single integer $$$N$$$ $$$(2 \le N \le 2 \cdot 10^5)$$$, the number of settlements on Vvardenfell where raw ebony is traded.

The second line contains $$$N$$$ integers $$$p_1, p_2, \ldots, p_N$$$ $$$(1 \le p_i \le 10^9)$$$, where $$$p_i$$$ is the price of one unit of raw ebony at the $$$i$$$-th settlement.

Output

Print a single integer: the maximum profit the merchant can achieve.

Examples
Input
5
7 1 5 3 6
Output
6
Input
3
10 10 10
Output
0