CBOJ Welcome Contest Problem 2 - Eating Candies


Submit solution

Points: 5 (partial)
Time limit: 1.0s
Memory limit: 128M

Author:
Problem type

Bob was given a bag of \(N\) candies! He would love to eat some of the \(N\) candies from his bag, but has to do it without raising suspicion from his parents.

Each candy has been labelled with an integer. The parents will get suspicious if one of the candy types goes completely missing (the candy type should not be missing before Bob received the bag).

What is the maximum number of candies Bob can eat?

Input Specification

The first line of the input will contain an integer \(N\) \((1 \le N \le 10^5)\), indicating the number of candies.

The next \(N\) lines of the input will each contain an integer ranging from \(0\) to \(10^9\) inclusive, indicating the type of the candy.

Output Specification

Output an integer, representing the maximum number of candies that Bob can eat without raising suspicion from his parents.

Subtasks

Subtask 1 [30%]

\(1 \le N \le 1000\)

All candy types will range from \(0\) to \(10^3\) inclusive.

Subtask 2 [40%]

\(1 \le N \le 10^5\)

All candy types will range from \(0\) to \(10^5\) inclusive.

Subtask 3 [30%]

No additional constraints.

Sample Input 1

3
6
0
2

Sample Output 1

0

Sample Explanation 1

Bob cannot eat any of the candies.

Sample Input 2

4
6
0
2
2

Sample Output 2

1

Sample Explanation 2

Bob can eat one of the candies of type \(2\).


Comments

There are no comments at the moment.