#K62432. Minimum Operations to Clear the Conveyor Belt

    ID: 31530 Type: Default 1000ms 256MiB

Minimum Operations to Clear the Conveyor Belt

Minimum Operations to Clear the Conveyor Belt

You are given a conveyor belt consisting of n compartments. Each compartment contains an item represented by an integer, which signifies its type. In one operation, you can remove all occurrences of a chosen item type from the conveyor belt.

Your task is to determine the minimum number of operations required to clear the conveyor belt. Essentially, this is equivalent to counting the number of distinct item types on the belt.

The answer can be summarized by the formula:

\( \text{operations} = |\{a_1,a_2,...,a_n\}| \)

where \(|\{a_1,a_2,...,a_n\}|\) represents the number of unique elements in the list of items.

inputFormat

The input is read from stdin and consists of two lines:

  • The first line contains an integer n, representing the number of compartments on the conveyor belt.
  • The second line contains n space-separated integers, where each integer represents the item type in the corresponding compartment.

outputFormat

Output a single integer to stdout — the minimum number of operations required to clear the conveyor belt.

## sample
5
1 2 2 3 1
3