#C4373. Maximum Unique Flowers
Maximum Unique Flowers
Maximum Unique Flowers
Sarah has a collection of flowers represented by integers. She wants to plant as many flowers as possible in a row such that no two adjacent flowers are of the same type. Since placing two identical flowers next to each other is prohibited, the optimal strategy is to choose at most one flower from each type.
Your task is to compute the maximum number of flowers Sarah can plant under this rule.
Note: Since one flower from every unique type can be arranged in any order without violating the adjacent rule, the answer is simply the number of unique flower types provided.
The underlying mathematical concept can be expressed in LaTeX as follows:
$$\text{Answer} = \left| \{ a_i : a_i \in \text{flower\_list} \} \right| $$inputFormat
The input is given via standard input (stdin). The first line contains a single integer (n) (1 ≤ n ≤ 10^5) representing the number of flowers. The second line contains (n) space-separated integers where each integer represents the type of a flower.
outputFormat
Output a single integer to standard output (stdout) — the maximum number of flowers Sarah can plant, which is equal to the number of unique flower types.## sample
5
1 2 3 4 5
5