B - Monocolor Editorial /

Time Limit: 2 sec / Memory Limit: 1024 MiB

配点 : 200

問題文

N 個のボールがあります。各ボールは色 1 から色 N までの N 色のいずれかで塗られており、i 個目 (1\le i\le N) のボールの色は C_i です。

あなたは 1 回の操作で好きなボール 1 つを好きな N 色のいずれかに変更することができます。

全てのボールが同じ色になるようにするためには、最小で何回の操作が必要か求めてください。

制約

  • 1\le N\le 100
  • 1\le C_i\le N
  • 入力される値は全て整数

入力

入力は以下の形式で標準入力から与えられる。

N
C_1 C_2 \ldots C_N

出力

答えを出力せよ。


入力例 1

4
3 1 2 1

出力例 1

2

1 個目のボールの色を 1 に、3 個目のボールの色を 1 にすることで全てのボールの色を同じ色にすることができます。

2 個未満のボールの色を変えることで全てのボールの色を同じ色にすることはできないので、2 を出力してください。


入力例 2

5
3 3 3 3 3

出力例 2

0

最初から全てのボールの色が同じ場合もあります。


入力例 3

9
4 2 3 3 4 1 2 7 1

出力例 3

7

Score : 200 points

Problem Statement

There are N balls. Each ball is painted in one of N colors: color 1 through color N. The color of the i-th ball (1\le i\le N) is C_i.

In one operation, you can change the color of any one ball to any of the N colors.

Find the minimum number of operations required to make all the balls the same color.

Constraints

  • 1\le N\le 100
  • 1\le C_i\le N
  • All input values are integers.

Input

The input is given from Standard Input in the following format:

N
C_1 C_2 \ldots C_N

Output

Output the answer.


Sample Input 1

4
3 1 2 1

Sample Output 1

2

By changing the color of the first ball to 1 and the color of the third ball to 1, you can make all the balls the same color.

It is impossible to make all the balls the same color by changing the colors of fewer than two balls, so output 2.


Sample Input 2

5
3 3 3 3 3

Sample Output 2

0

All balls may have the same color from the beginning.


Sample Input 3

9
4 2 3 3 4 1 2 7 1

Sample Output 3

7