#C14207. Find Maximum Difference

    ID: 43831 Type: Default 1000ms 256MiB

Find Maximum Difference

Find Maximum Difference

You are given a list of integers. Your task is to compute the maximum difference between any two elements in the list. Formally, given an array \(A = [a_1, a_2, \ldots, a_n]\), the answer is \(\max(A) - \min(A)\). If the list contains fewer than two elements, output 0.

The input will be provided via standard input and the output should be printed to standard output.

inputFormat

The first line of input contains an integer \(n\) denoting the number of elements in the list. If \(n > 0\), the second line contains \(n\) space-separated integers.

outputFormat

Output a single integer representing the maximum difference between any two numbers in the list. If there are fewer than two elements, output 0.

## sample
0
0