#K4666. Sum of Prime Numbers

    ID: 28026 Type: Default 1000ms 256MiB

Sum of Prime Numbers

Sum of Prime Numbers

Given a list of integers, your task is to compute the sum of all the prime numbers in the list. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The solution should read input from standard input (stdin) and print the result to standard output (stdout).

The mathematical definition of a prime number can be written in LaTeX as follows: $$ p \text{ is prime if } p > 1 \text{ and } \forall d \in \mathbb{N},, (d|p \Rightarrow (d = 1 \text{ or } d = p)). $$

inputFormat

The first line of the input contains a single integer n, representing the number of elements in the list. The second line contains n space-separated integers representing the elements of the list.

outputFormat

Output a single integer which is the sum of all prime numbers in the list.## sample

10
1 2 3 4 5 6 7 8 9 10
17