#C5268. Frequency Spread

    ID: 48898 Type: Default 1000ms 256MiB

Frequency Spread

Frequency Spread

Given an array (A) of length (N), compute the frequency spread defined as the difference between the maximum frequency and the minimum frequency of the numbers in the array. Let (f(x)) be the frequency of an element (x). Then the frequency spread is (\max(f(x)) - \min(f(x))). If the array contains all unique elements or all elements are identical, the spread will be 0. The input is read from (stdin) and the result should be printed to (stdout).

inputFormat

The first line contains an integer (N) indicating the length of the array. The second line contains (N) space-separated integers representing the elements of the array.

outputFormat

A single integer representing the frequency spread of the array.## sample

6
4 5 6 4 6 4
2