import java.util.*;
public class Main {
static boolean prime(int m) {
if (m != 1) {
for (int j = 2; j <= Math.sqrt(m); j++) {
if (m % j == 0) {
return false;
}
} return true;
}
return false;
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int count = 0;
for (int i = 0; i < n; i++) {
int m = sc.nextInt();
if (prime(m)) {
count++;
}
}
System.out.println(count);
}
}
728x90
반응형
'매일코테' 카테고리의 다른 글
백준 8단계 no.3 (0) | 2022.07.25 |
---|---|
백준 8단계 no.2 (0) | 2022.07.25 |
백준 7단계 no.8 (0) | 2022.07.24 |
백준 7단계 no.7 (0) | 2022.07.24 |
백준 7단계 no.6 (0) | 2022.07.24 |