eolymp
bolt
Try our new interface for solving problems
Problems

Balloons

Balloons

The seller has n balloons. Each balloon has some color. However, recently Three Fat Men issued a decree permitting to sell the balls of a single color. In order not to break the law, but not to lose profits, the seller decided to repaint some of his balls.

Write a program to determine the minimum number of repainting.

Input

First line contains the number of balloons n (1n105). Second line contains n integers in the range from 1 to 9, determining the colors of the balls (1 - blue, 2 - green, 3 - cyan, 4 - red, 5 - rose, 6 - yellow, 7 - gray, 8 - black, 9 - white).

Output

Print the minimum number of balloons to repaint so that all balls have the same color.

Time limit 1 second
Memory limit 128 MiB
Input example #1
4
3 1 2 1

Output example #1
2
Input example #2
4
4 9 9 6
Output example #2
2
Input example #9
1
1
Output example #9
0