New Year's '18 P2 - Mimi and Christmas Cake

View as PDF

Submit solution


Points: 5 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type

For Christmas, Mimi got a fruit cake from her parents. The cake is sliced into N slices, and the i^\text{th} slice has f_i pieces of fruit on it. However, as Mimi is trying to lose weight as a New Year's resolution, she will only eat slices which have a prime number of fruits on them. Help Mimi determine how many slices of cake she can eat.

Constraints

Subtask 1 [10%]

1 \le N \le 100
1 \le f_i \le 100

Subtask 2 [10%]

1 \le N \le 10^5
1 \le f_i \le 1\,000

Subtask 3 [80%]

1 \le N \le 10^5
1 \le f_i \le 10^5

Input Specification

The first line of input will contain a single integer, N, the number of slices.
The next and final line of input will contain N space-separated integers: f_1, f_2, \dots, f_N, the number of pieces of fruit on the i^\text{th} slice of cake.

Output Specification

A single integer, the number of slices of cake Mimi can eat.

Sample Input

3
1 5 8

Sample Output

1

Comments

There are no comments at the moment.