#CCBCHBAHAI0000081. Equalize the Array
Equalize the Array
Equalize the Array
Source: HackerRank
Version: Phuoc Hung OJ Extended
Problem
Given an integer array of length , delete the minimum number of elements so that all remaining elements are equal. Let
Keeping a value requires deletions, hence the answer is
Compute .
Input
The first line contains . The second line contains integers .
Output
Print , the minimum number of deletions.
Subtask
Subtask 1 (20 points): , .
Subtask 2 (30 points): , .
Subtask 3 (50 points): , .
Example
Input
5
3 3 2 1 3
Output
2
Explanation
The output follows directly from the mathematical definition above.