Averages

0

0 votes
Problem

You are given a array of integers. Find the diff between the maximum average value and minimum average value of sub-sequences of array.

Input: First line contains a single integer denoting N, the number of elements of array. Next line contains N space separated integers denoting the array.

Output:

Print the greatest integer of the answer. Greatest integer of 2.5 is 2. Greatest integer of 2 is 2.

Constraints

1 <= N <= 500, 0 <= A[i] <= 10^5

Sample Input
4
1 2 1 2
Sample Output
1
Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

Minimum Average value of sub-sequence 1, 1 is 1. Maximum Average value of sub-sequence 2, 2 is 2.Therefore answer is 2-1=1

P.S. : A subsequence of a string is not necessarily continuous.

Editor Image

?