#P8494. Rarest Insect Type Cardinality

    ID: 21668 Type: Default 1000ms 256MiB

Rarest Insect Type Cardinality

Rarest Insect Type Cardinality

Pak Blangkon's house is surrounded by N insects numbered from 0 to N-1. Each insect has a type represented by an integer between 0 and 10^9 inclusive. Insects of the same type are grouped together. The most common insect type's cardinality is defined as the maximum number of insects in any group. Similarly, the rarest insect type's cardinality is defined as the minimum number of insects in any group.

For example, if there are 11 insects with types: [5, 7, 9, 11, 11, 5, 0, 11, 9, 100, 9], then the most common insect type has a cardinality of 3 (both types 9 and 11 occur 3 times) and the rarest insect type has a cardinality of 1 (types 7, 0, and 100 each occur once).

You are given the list of insect types. Your task is to determine the cardinality of the rarest insect type.

Input Machine Note: In the original scenario, Pak Blangkon is unaware of the insect types and uses a machine with three operations: inserting an insect, removing an insect, and pressing a button that returns the cardinality of the most common insect type among insects in the machine. However, for this problem you are provided with the insect types directly as input.

inputFormat

The first line contains an integer N (the total number of insects). The second line contains N integers representing the insect types.

outputFormat

Output a single integer: the cardinality of the rarest insect type (i.e. the minimum frequency among all insect types).

sample

11
5 7 9 11 11 5 0 11 9 100 9
1

</p>