#K2331. Product of Unique Elements

    ID: 24713 Type: Default 1000ms 256MiB

Product of Unique Elements

Product of Unique Elements

Given a list of integers, compute the product of all unique elements. If the list is empty, then the product is defined to be 1. More formally, if the list is \( A = [a_1, a_2, \dots, a_n] \) and \( U \) is the set of unique elements of \( A \), calculate the product:

\( \prod_{x \in U} x \)

Note: Duplicated elements are considered only once in the product.

inputFormat

The input consists of two lines:

  • The first line contains a single integer \( N \) (\( N \ge 0 \)) denoting the number of elements.
  • If \( N > 0 \), the second line contains \( N \) space-separated integers.

outputFormat

Output a single integer representing the product of all unique integers in the list. If the list is empty, output 1.

## sample
5
2 3 2 4 3
24

</p>