cswork / OAOpen practice workspace

OtherOA #10

Maximum Adjacent Gap

EasyJudge-ready

Topics (AI-labelled)In-place Arrays

Find the maximum absolute difference between adjacent elements in input order. The source's examples and constraints are explicit; this site adds the standard input protocol.

Input

The first line contains n (1≤n≤1000), and the second line contains n integers in the range −100000..100000.

Output

Output the maximum absolute difference between adjacent elements of the original array; for a single-element array, output 0.

Example 1

Input:

4
3 8 2 10

Output:

8

Example 2

Input:

1
7

Output:

0

Example 3

Input:

4
-4 -10 6 1

Output:

16

Editorial

Loading solution…