has practically a gazillion dolls. Unfortunately, he has so many that some of them are duplicates and he didn't even notice. A universal doll scanner has scanned his room and generated a list of the prices of the dolls. Given a list of the prices, determine the difference between the price of the most frequent doll, and the least frequent doll.
Note: If there are multiple dolls of the highest frequency, use the one with the greatest price, and if there are multiple dolls of the lowest frequency, use the one with the lowest price.
Input Specification
The first line will contain an integer , the number of dolls that has in his room.
The second line will contain the integers, separated by spaces, representing the prices, , of the dolls.
Output Specification
Output the absolute difference between the price of the most frequent doll, and the price of the least frequent doll.
Sample Input
6
10 20 10 40 40 40
Sample Output
20
Explanation for Sample Output
The most frequent doll is and the least frequent is . The difference between the two numbers is .
Comments
can i get a lil assistance over here
i am going to eat u
is MathBunny123 a furry
This comment is hidden due to too much negative feedback. Show it anyway.
...