SDE Path

Minimum Adjacent Difference

Easy

Minimum Adjacent Difference

Find the smallest gap between neighboring elements.

Input format

The first line contains N (at least 2). The second line contains N space-separated integers.

Output format

Print the smallest absolute difference between two elements that are next to each other.

Constraints

  • Values fit in a 64-bit signed integer
  • Trailing whitespace and a trailing newline are ignored by the judge

Read from stdin, write to stdout. Sample cases below show the exact format.

Sample cases

Example 1
Input
5
4 8 6 6 1
Expected output
0
Example 2
Input
4
1 10 20 21
Expected output
1