#K58582. Sum of Primes

    ID: 30674 Type: Default 1000ms 256MiB

Sum of Primes

Sum of Primes

You are given a list of integers. Your task is to compute the sum of all prime numbers in the list.

A prime number is defined as a natural number greater than 1 that has no positive divisors other than 1 and itself. For example, 2, 3, 5, 7, etc. are prime numbers.

The input will be provided from standard input (stdin) and the result should be printed to standard output (stdout). Ensure your program correctly handles the input format and edge cases.

Use the following mathematical criterion for a number \(n\) to be a prime: \(n > 1\) and \(n\) is not divisible by any integer \(d\) such that \(2 \leq d \leq \sqrt{n}\).

inputFormat

The first line of the input contains a single integer \(n\) — the number of elements in the list. The second line contains \(n\) space-separated integers.

Example:

5
1 2 3 4 5

outputFormat

Output a single integer representing the sum of all prime numbers from the input list.

Example:

10
## sample
5
1 2 3 4 5
10