#K34377. Maximum Boundary Difference
Maximum Boundary Difference
Maximum Boundary Difference
You are given an array of N integers. Your task is to compute the maximum difference between any two elements in the array such that no other element exists between them in value. In this context, the answer is simply the difference between the maximum and minimum elements, i.e. $$\max\;\text{array} - \min\;\text{array}$$. If the array contains fewer than two elements, output 0.
inputFormat
The input is provided via standard input (stdin). The first line contains a single integer N, representing the number of elements in the array. The second line contains N space-separated integers representing the elements of the array.
outputFormat
Output a single integer which is the maximum difference between the maximum and minimum element in the array. If N < 2, output 0.
## sample5
1 2 3 4 5
4