#K42622. Sum of Unique Prime Factors

    ID: 27129 Type: Default 1000ms 256MiB

Sum of Unique Prime Factors

Sum of Unique Prime Factors

Given a list of n integers, your task is to compute the sum of all unique prime factors that appear in the factorization of the numbers in the list.

For every integer \( a_i \) in the list, express it in its prime factorization form as \[ a_i = \prod_{j}p_{ij}^{e_{ij},} \] then collect all distinct primes \( p_{ij} \) from all factorizations. The answer is the sum of these unique primes.

Note: If an integer is 1, it has no prime factors.

inputFormat

The input is read from standard input (stdin). The first line contains a single integer \( n \) denoting the number of elements in the list. The second line contains \( n \) space-separated integers.

outputFormat

Output a single integer to standard output (stdout), which is the sum of all unique prime factors of the given numbers.

## sample
1
12
5

</p>