#K42577. Lighting Candles in Rounds

    ID: 27118 Type: Default 1000ms 256MiB

Lighting Candles in Rounds

Lighting Candles in Rounds

You are given a set of candles each with a specific height. In one round, you can light all the candles that share the same height. Your task is to calculate the minimum number of rounds required to light all the candles.

Input Format: The input consists of two lines. The first line contains an integer n, representing the number of candles. The second line contains n space-separated integers, where each integer represents the height of a candle.

Output Format: Print a single integer, which is the number of rounds required to light all the candles. This is essentially the number of distinct candle heights.

The answer can be expressed in the formula:

[ \text{rounds} = |{ h_i : 1 \leq i \leq n }| ]

where \(h_i\) represents the height of the \(i^{th}\) candle and \(|\cdot|\| denotes the cardinality of the set.

inputFormat

The input is read from stdin and has the following format:

  • The first line contains an integer n (1 ≤ n ≤ 105), the number of candles.
  • The second line contains n space-separated integers representing the heights of the candles. Each height is a positive integer.

outputFormat

Output a single integer to stdout—the number of rounds needed to light all the candles, which equals the number of unique candle heights.

## sample
4
2 3 2 1
3

</p>