Problem:
Prime Numbers A prime number is a natural number which has exactly two distinct natural number divisors: 1 and itself. For example, the first four prime numbers are: 2, 3, 5 and 7. Write a program which reads a list of N integers and prints the number of prime numbers in the list. Input The first line contains an integer N , the number of elements in the list.  N numbers are given in the following lines. Output Print the number of prime numbers in the given list. Constraints 1 ≤ N ≤ 10000 2 ≤ an element of the list ≤ 10 8  Sample Input 1 5
2
3
4
5
6 Sample Output 1 3 Sample Input 2 11
7
8
9
10
11
12
13
14
15
16
17 Sample Output 2 4

Solution (Python):
import sys

import math




"""Template"""


class IP:
    """
    入力を取得するクラス
    """

    def __init__(self):
        self.input = sys.stdin.readline

    def I(self):
        """
        1文字の取得に使います
        :return: int
        """
        return int(self.input())

    def S(self):
        """
        1文字の取得(str
        :return: str
        """
        return self.input()

    def IL(self):
        """
        1行を空白で区切りリストにします(int
        :return: リスト
        """
        return list(map(int, self.input().split()))

    def SL(self):
        """
        1行の文字列を空白区切りでリストにします
        :return: リスト
        """
        return list(map(str, self.input().split()))

    def ILS(self, n):
        """
        1列丸々取得します(int
        :param n: 行数
        :return: リスト
        """
        return [int(self.input()) for _ in range(n)]

    def SLS(self, n):
        """
        1列丸々取得します（str
        :param n: 行数
        :return: リスト
        """
        return [self.input() for _ in range(n)]

    def SILS(self, n):
        """
        Some Int LineS
        横に複数、縦にも複数
        :param n: 行数
        :return: list
        """
        return [self.IL() for _ in range(n)]

    def SSLS(self, n):
        """
        Some String LineS
        :param n: 行数
        :return: list
        """
        return [self.SL() for _ in range(n)]


class Idea:
    def __init__(self):
        pass

    def HF(self, p):
        """
        Half enumeration
        半分全列挙です
        pの要素の和の組み合わせを作ります。
        ソート、重複削除行います
        :param p: list : 元となるリスト
        :return: list : 組み合わせられた和のリスト
        """
        return sorted(set(p[i] + p[j] for i in range(len(p)) for j in range(i, len(p))))

    def Bfs2(self, a):
        """
        bit_full_search2
        bit全探索の改良版
        全探索させたら2進数のリストと10進数のリストを返す
        :return: list２つ : １個目 2進数(16桁)  2個目 10進数
        """
        
        
        
        value = []
        for i in range(1 << len(a)):
            output = []

            for j in range(len(a)):
                if self.bit_o(i, j):
                    """右からj+1番目のiが1かどうか判定"""
                    
                    output.append(a[j])
            value.append([format(i, 'b').zfill(16), sum(output)])

        value.sort(key=lambda x: x[1])
        bin = [value[k][0] for k in range(len(value))]
        val = [value[k][1] for k in range(len(value))]
        return bin, val

    def S(self, s, r=0, m=-1):
        """
        ソート関係行います。色々な設定あります。
        :param s: 元となるリスト
        :param r: reversするかどうか 0=False 1=True
        :param m: （2次元配列）何番目のインデックスのソートなのか
        :return: None
        """
        r = bool(r)
        if m == -1:
            s.sort(reverse=r)
        else:
            s.sort(reverse=r, key=lambda x: x[m])

    def bit_n(self, a, b):
        """
        bit探索で使います。0以上のときにTrue出します
        自然数だからn
        :param a: int
        :param b: int
        :return: bool
        """
        return bool((a >> b & 1) > 0)

    def bit_o(self, a, b):
        """
        bit探索で使います。1のときにTrue出すよ
        oneで1
        :param a: int
        :param b: int
        :return: bool
        """
        return bool(((a >> b) & 1) == 1)

    def ceil(self, x, y):
        """
        Round up
        小数点切り上げ割り算
        :param x: int
        :param y: int
        :return: int
        """
        return -(-x // y)

    def ave(self, a):
        """
        平均を求めます
        :param a: list
        :return: int
        """
        return sum(a) / len(a)

    def gcd(self, x, y):
        if y == 0:
            return x
        else:
            return self.gcd(y, x % y)


"""ここからメインコード"""


def main():
    
    r, e, p = range, enumerate, print
    ip = IP()
    id = Idea()
    mod = 10 ** 9 + 7

    """この下から書いてね"""
    def is_prime(n):
        if n == 1: return False

        for k in range(2, int(math.sqrt(n)) + 1):
            if n % k == 0:
                return False

        return True
    n = ip.I()
    ans = 0
    for _ in r(n):
        a = ip.I()
        if is_prime(a):
            ans += 1
    p(ans)



main()

Solution (Python):
import math

c = 0
n = int(input())

for i in range(n):
    m = int(input())

    if m == 2:
        c += 1
    elif m > 2:
        for j in range(2, int(math.sqrt(m)) + 2):
            if m % j == 0:
                break
            if j == int(math.sqrt(m)) + 1:
                c += 1

print(c)

Solution (Python):
from math import sqrt
def isprime(num):
    if num == 2:
        return True
    if num < 2 or num % 2 == 0:
        return False
    for i in range(3,int(sqrt(num))+1,2):
        if num % i == 0:
            return False
    return True

a = int(input())
c = 0
for j in range(a):
    b = int(input())
    c += isprime(b)
print(c)

Solution (Python):
def isPrime(x):
    if x == 2:
        return True

    if (x < 2 or x%2 == 0):
        return False

    i = 3
    while i <= x**0.5:
        if x%i == 0:
            return False
        i = i + 2

    return True

n = int(input())
count = 0
for i in range(n):
    x = int(input())
    if isPrime(x) == True:
        count += 1
print(count)

Solution (Python):
n = int(input())
c = 0
for _ in range(n):
    a = int(input())
    if a % 2 == 0:
        if a != 2:
            c += 1
        continue
    for b in range(3,a,2):
        if a % b == 0:
            c += 1
            break
        if b * b > a:
            break
print(n-c)

Solution (Python):
def isPrime(n):
	for i in range(2, n):
		if i*i>n:
			return 1
		if n % i == 0:
			return 0
	return 1

num = int(input())
result = 0
for _ in range(num):
    target = int(input())
    result += isPrime(target)

print(result)

Solution (Python):
def is_prime(p):
    for i in range(2, int(p**(1/2))+ 1):
        if p % i == 0:
            return False
    
    return True


n = int(input())
count = 0
for _ in range(n):
    p = int(input())
    if is_prime(p):
        count += 1

print(count)

Solution (Python):
import math

N = int(input())
A = []
prim = 0
for i in range(N):
    x = int(input())
    A.append(x)

for j in range(len(A)):
    num = 0

    if A[j] == 2:
        prim += 1
    else:
        for k in range(2, int(math.sqrt(A[j]))+1):
            if A[j] == 1:
                pass
            elif A[j]%k == 0:
                break
        else:
            prim += 1
print(prim)

Solution (Python):
N = int(input())
not_prime = 0
 
for loop in range(N):
    num = int(input())
 
    if num%2 == 0:
        if num != 2:
            not_prime += 1
    else:
        for i in range(3,num,2):
            if i*i > num:
                break
            if num%i == 0:
                not_prime += 1
                break
 
print("%d"%(N-not_prime))

Solution (Python):
import math

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False
    return True

ans=0
for i in range(int(input())):
    b=int(input())
    ans+=(is_prime(b))
    
print(ans)

Solution (Python):
count = int(input())
primeCount = 0
for i in range(count):
    num = int(input())
    beki = num**(1/2)
    if beki%1 == 0:
        chkmax = beki//1
    else:
        chkmax = beki//1 + 1
    chkmax = int(chkmax)

    flag = True
    for i in range(2,chkmax+1):
        if num%i == 0:
            flag = False
            break

    if flag or num == 2:
        primeCount += 1

print(primeCount)

Solution (Python):



def isPrime(x):
    if x == 2:
        return True
    elif x < 2 or x % 2 ==0:
        return False
    else :
        i = 3
        while i <= x ** 0.5:
            if x % i == 0:
                return False
            i += 1
        return True

num_of_numbers = int(input())
cnt = 0
for i in range(num_of_numbers):
    x = int(input())
    if isPrime(x):
        cnt += 1
print(cnt)

Solution (Python):
def isPrime(x):
    if x <= 1:
        return 0
    for i in range(2, int(x**0.5) + 1):
        if x % i == 0:
            return 0
    return 1

n = int(input())
sum = 0

for i in range(n):
    if isPrime(int(input())):
        sum += 1
print(sum)

Solution (Python):
from math import sqrt

def is_prime(n):
	if n<4:
		return True
	else:
		s = int(sqrt(n))
		for i in range(2, s+1):
			if not n%i:
				return False
		return True
n = int(input())
count = 0
for i in range(n):
    if is_prime(int(input())):
        count += 1
print(count)

Solution (Python):
n = int(input())
mlist = []
plist = [2]
for i in range(3,10000):
    count = 0
    for k in plist:
        if (i%k != 0):
            count += 1
        else:
            break
    if (count == len(plist)):
        plist.append(i)
def check(m):
    for p in plist:
        if (m <= p):
            return True
        if m%p == 0:
            return False     
    return True

count = 0
for i in range(n):
    m = int(input())
    if check(m):
        count += 1
        
print(count)

Solution (Python):

def is_prime(x):
    if x == 2:
        return True
    if x < 2 or x % 2 == 0:
        return False
    for i in range(3, int(x**0.5+1),2):
        if x % i == 0:
            return False
        
    return True

N = int(input())
cnt = 0
for _ in range(N):
    i = int(input())
    cnt += is_prime(i)
print(cnt)

Solution (Python):
n = int(input())
total = 0
for i in range(n) :
    x = int(input())
    a = 1
    b = True
    if x == 1 :
        b = False
    while a**2 < x and x != 2 :
        a += 1
        if x%a == 0 :
            b = False
            break  
    if b :
        total += 1
print (total)

Solution (Python):
import math


def isprime(x):
    for i in range(2,int(math.sqrt(x)) + 1):
        if x % i == 0:
            return 0
    return 1


n = int(input())
cnt = 0
for i in range(n):
    x = int(input())
    if isprime(x):
        cnt += 1
print(cnt)

Solution (Python):

import math
def isPrime(n):
    if n == 1:
        return False
    if n == 2:
        return True
    if n % 2 == 0:
        return False
    for i in range(3, int(math.sqrt(n))+1,2):
        if n % i == 0:
            return False
    return True
            

n = int(input().rstrip())
count = 0
for i in range(n):
    if isPrime(int(input().rstrip())):
        count += 1
print(count)

Solution (Python):
N = int(input())
ans = 0
for i in range(N):
    n = int(input())
    if n==2:ans+=1
    elif n%2==0:continue
    for j in range(3,n+1,2):
        if j**2 > n:
            ans+=1
            break
        if n%j==0:break
print(ans)

Solution (Python):
n=int(input())
count=0

def is_prime(x):
    if x<=1:
        return False
    if x==2:
        return True
    if x>=3:
        for i in range(2,int(x**0.5)+1):
            if x%i==0:
                return False
    return True

for k in range(n):
    x=int(input())
    if is_prime(x):
        count+=1
print(count)

Solution (Python):
def isPrime(num):
    '''int -> boolean
    return True/False of Is num a prime number 
    '''
    if num == 2:
        return True
    elif num <= 1 or num %2 == 0:
        return False
    import math
    maxp = int(math.sqrt(num))
    for p in range(3, maxp + 1):
        if num % p == 0:
            return False
    return True
n = int(input())
cnt = 0
for i in range(n):
    num = int(input())
    if isPrime(num) == True:
        cnt += 1
print(cnt)

Solution (Python):
def isPrime(num):
        if num <= 1:
                return False
        elif num == 2 or num == 3:
                return True
        if num % 2 == 0 or num % 3 == 0:
                return False
        if not(num % 6 == 1) and not(num % 6 == 5):
                return False
        i = 5
        while i * i <= num:
                if num % i == 0 or num % (i + 2) == 0:
                        return False
                i += 6
        return True

num = int(input())
count = 0
for i in range(num):
        if isPrime(int(input())):
                count += 1

print(count)

Solution (Python):
import sys, math
input = sys.stdin.readline

def is_prime(n):
    if n == 1: return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

N = int(input())
IN = set([int(input()) for _ in range(N)])

cnt = 0

for x in IN:
    if is_prime(x):
        cnt += 1

print(cnt)

Solution (Python):
import math

N = int(input())
nums = [int(input()) for _ in range(N)]

def is_prime(num):
    if num < 2:
        return False
    else:
        num_sqrt = math.floor(math.sqrt(num))
        for prime in range(2, num_sqrt + 1):
            if num % prime == 0:
                return False
                break
        return True

print(len([n for n in nums if is_prime(n)]))

Solution (Python):
import math


def is_prime(n):
    if n == 1:
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True


n = int(input())
nums = list(set([int(input()) for _ in range(n)]))
print(len([num for num in nums if is_prime(num)]))

Solution (Python):
import math

def isprime(x):
    if x == 2:
        return 1

    if x < 2 or x % 2 == 0 :
        return 0

    i = 3
    while i <= math.sqrt(x) :
        if x % i == 0 :
            return 0
        i += 2
    else :
        return 1
        
ans=0
N=int(input())
for k in range(N):
    x=int(input())
    ans = ans + isprime(x)
print(ans)

Solution (Python):
def pn_bool(x):
    if x == 2: return True
    if x % 2 == 0 or x < 2: return False
    sqrt_x = x ** 0.5
    for i in range(3, int(sqrt_x) + 1, 2):
        if x % i == 0:
            return False
    return True


count = 0
for _ in range(int(input())):
    if pn_bool(int(input())):
        count += 1
print(count)

Solution (Python):

import math

n = int(input())
count = 0

for loop in range(n):
    a = int(input())
    flag = True
    if a == 1:
        flag = False
    elif a == 2:
        flag = True
    else:
        if a % 2 == 0:
            flag = False
        for j in range(3, int(math.sqrt(a))+1, 2):
            if a % j == 0:
                flag = False
    if flag:
        count += 1

print(count)

Solution (Python):
import math

def isPrime(x):
    if x == 2:
        return True

    if x < 2 or x % 2 == 0:
        return False

    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i += 2
    return True

count = 0
n = int(input())
for i in range(0,n):
    flg = isPrime(int(input()))
    if flg:
        count += 1

print(count)

Solution (Python):
def prime(n):
    if n==1:return 0
    for i in range(2,int(n**0.5)+1):
        if n%i==0:
            return 0
    return 1

n=int(input())
ans=0
for i in range(n):
    ans+=prime(int(input()))
print(ans)

Solution (Python):
import math
def isPrime(x):
    if x == 2:
        return True
    if x < 2 or x % 2 == 0:
        return False
    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return False
        i = i + 2
    return True

if __name__ == '__main__':
    N = int(input())
    a = []
    for i in range(N):
        a.append(int(input()))
    counter = 0
    for x in a:
        if isPrime(x):
            counter += 1
    print(counter)

Solution (Python):
from sys import stdin

n = int(stdin.readline().rstrip())
nNum = [int(stdin.readline().rstrip()) for i in range(n)]

def isPrime(n):
    if n == 2:
        return True
    elif n < 2 or n%2 == 0:
        return False

    for i in range(3, n, 2):
        if i*i > n:
            break
        elif n%i == 0:
            return False

    return True

print(len([True for x in nNum if isPrime(x)]))

Solution (Python):
import math
input_num = int(input())
input_list = [int(input()) for i in range(input_num)]
input_list.sort()

max = input_list[len(input_list)-1]
sqrt_max = int(math.sqrt(max))
nums = [i + 2 for i in range(sqrt_max - 1)]
for num in input_list:
    if num > sqrt_max:
        nums.append(num)

prime_nums = []
while True:
    first_num = nums[0]
    if first_num > math.sqrt(max):
        break
    prime_nums.append(first_num)
    deleted = 0
    for i in range(len(nums)):
        index = i - deleted
        if nums[index] % first_num == 0:
            del nums[index]
            deleted += 1

prime_nums.extend(nums)

prime_count = 0
for num in input_list:
    if num in prime_nums:
        prime_count += 1

print(prime_count)

Solution (Python):
def isPrime(num):
    if num == 2 or num == 3:
        return True
    elif num % 2 == 0:
        return False

    p = 3
    sqrt_num = int(num ** 0.5)
    while True:
        if num % p == 0:
            return False

        if sqrt_num >= p:
            p += 2
        else:
            return True


n = int(input())
input_num = [int(input()) for _ in range(n)]

print(len(list(filter(lambda x: isPrime(x), input_num))))

Solution (Python):
import math

def isPrime(x):
	for i in range(2,int(math.sqrt(x))+1):
		if x%i == 0:
			return 0
	return 1

n=int(input())
ans=0
for i in range(n):
	x=int(input())
	if isPrime(x):
		ans+=1
print(ans)

Solution (Python):
from math import sqrt
def isPrime(number):
    divisor = 3
    if number == 2:
        return True
    if number % 2 == 0:
        return False
    while divisor <= sqrt(number):
        if number % divisor == 0:
            return False
        divisor += 2
    return True

def main():
    N = eval(input())
    count = 0
    for i in range(0, N):
        number = eval(input())
        if (isPrime(number)):
            count += 1
    print(count)

main()

Solution (Python):
import math
n = int(input())
cnt = 0
for _ in range(n):
    x = int(input())
    if x == 2: cnt += 1
    if x < 2 or x%2 == 0: continue
    i = 3
    while i <= math.sqrt(x):
        if x%i == 0: break
        i += 2
    if not i <= math.sqrt(x): cnt += 1
print(cnt)

Solution (Python):
N=int(input())
A=[]
for i in range(N):
    A.append(int(input()))
count=0
for i in range(len(A)):
    if A[i]<2:
        continue
    elif A[i]==2:
        count += 1
        continue
    if A[i]%2==0:
        continue
    elif A[i]>=3:
        j=3
        flag=0
        while j<=A[i]/j:
            if A[i]%j==0:
                flag=1
                break
            j += 2
        if flag==0:
            count += 1
print(count)

Solution (Python):
import math

n = int(input())
a = [int(input()) for i in range(n)]
n = 0
for x in a:
    if x == 2:
        n += 1
        continue
    if x < 2 or x % 2 == 0:
        continue
    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            n -= 1
            break
        i = i + 2
    n += 1
print(n)

Solution (Python):
import math
def isPrime(x):
    if x==2:
        return True
    
    if x<2 or x%2==0:
        return False
    
    i = 3
    while i <= math.sqrt(x):
        if x%i == 0:
            return False
        i = i+2
    
    return True

if __name__ == "__main__":
    n = int(input())
    a = []
    for l in range(0,n,1):
        a.append(int(input()))
    cnt = 0
    for x in a:
        if isPrime(x):
            cnt += 1
    print(cnt)

Solution (Python):
def is_prime(q):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q&1 == 0: return False
    return pow(2, q-1, q) == 1
cnt=0

for i in range(int(input())):
    if is_prime(int(input()))==1:cnt+=1

print(cnt)

Solution (Python):
n = int(input())

def is_prime(n):
    for i in range(2, int(n**0.5)+1):
        if n % i == 0:
            return False
    return True

ans = 0
for i in range(n):
    if is_prime(int(input())):
        ans += 1

print(ans)

Solution (Python):
def isPrime(n):
    for i in range(2, n):
        if i * i > n:
            return 1
        if n % i == 0:
            return 0
    return 1

ans = 0
n = int(input())
for i in range(n):
    x = int(input())
    ans = ans + isPrime(x)

print(ans)

Solution (Python):
import math

primes = [2, 3, 5, 7]

def is_prime(n):
    n_sqrt = math.sqrt(n)
    if n_sqrt.is_integer():
        return False
    n_sqrt = int(n_sqrt+1)

    if n in primes:
        return True
    if any(n % i == 0 for i in primes):
        return False
    if n > 10 and any(n % i == 0 for i in range(2, n_sqrt)):
        return False
    return True

n = int(input().strip())
a = [int(input().strip()) for i in range(n)]

print(len(list(filter(is_prime, a))))

Solution (Python):
import math

def main():
	n = int(input())
	cnt = 0
	for _ in range(n):
		a = int(input())
		if isPrime(a):
			cnt += 1
	print(cnt)


def isPrime(x):
	if x == 2:
		return True

	if x < 2 or (x%2) == 0:
		return False

	i = 3
	while i <= math.sqrt(x):
		if (x%i) == 0:
			return False
		i  += 2
	
	return True

main()

Solution (Python):
n = int(input())
count = 0
j = 2

for i in range(n):
    tmp = int(input())
    limit = tmp ** 0.5
    r = round(limit)


    if r > 2:
        for j in range(2, r+1):
            if tmp%j == 0:
                count += 1
                break
    else:
        if tmp == 4:
            count += 1
        if tmp == 6:
            count += 1

print(n-count)

Solution (Python):
import math

def isprime(x):
    if x==2:
        return True
    
    if x<2 or x%2==0:
        return False
    i = 3

    while i<=math.sqrt(x):
        if x%i==0:
            return False
        i = i+2

    return True

n = int(input())
count = 0

for i in range(0, n):
    b = int(input())

    if isprime(b):
        count += 1

print(count)

Solution (Python):
import math

def fun(n):
    if n%2==0 and n!=2:return False
    for i in range(3,round(math.sqrt(n))+1,2):
        if n%i==0:return False
    else: return True

n=int(input())
count=0
for i in range(n):
    if fun(int(input())):
        count+=1
print(count)

Solution (Python):
import math


def is_prime(n: int)-> bool:
    if n == 2:
        return True
    if n < 2 or n % 2 == 0:
        return False

    for i in range(3, int(math.sqrt(n)) + 1, 2):
        if n % i == 0:
            return False
    return True


def main():
    num = int(input())
    count_prime = 0
    for i in range(num):
        if is_prime(int(input())):
            count_prime += 1
    print(count_prime)
    return

main()

Solution (Python):
import math
n=int(input())

def is_prime(x):
    if x == 1: return False
    for i in range(2,int(math.sqrt(x))+1):
        if x%i==0:
            return False
    return True

c=0
for i in range(n):
    m=int(input())
    if is_prime(m) is True:
        c+=1
    
print(c)

Solution (Python):
from math import sqrt

n = int(input())

count = 0

def isPrime(num):
    if num == 2:
        return True
    if num % 2 == 0:
        return False
    i = 3
    while i <= sqrt(num):
        if num % i == 0:
            return False
        i += 1
    return True

for i in range(0, n):
    num = int(input())

    if isPrime(num):
        count += 1

print(count)

Solution (Python):



import math
def isPrime(c):
    if (c == 2 ):
        return True
    if (c % 2 == 0 ):
        return False
    len = int(math.sqrt(c)) + 1
    for i  in range (3,len+1,2):
        if ( c % i == 0):
            return False  
    return True

cnt = 0
n = int(input())
while ( n > 0):
    n = n -1
    s = int(input())
    if ( isPrime(s) == True ):
        cnt += 1
print (cnt)

Solution (Python):
import math
n=int(input())
nums=[int(input()) for i in range(n)]

count=0
for num in nums:
    flag=0
    
    if num == 2:
        count+=1
        continue

    
    if num%2==0:
        continue
    
    for p in range(3, int(math.sqrt(num))+1, 2):
        if num%p==0:
            flag=1
            break
        
    if flag==0:
        count+=1
        
print(count)

Solution (Python):
import math


def is_prime(num):
    if num == 2:
        return True
    elif num % 2 == 0:
        return False

    for i in range(3, int(math.floor(math.sqrt(num))) + 1):
        if num % i == 0:
            return False
    return True


def solve():
    count = 0
    for _ in range(int(input())):
        if is_prime(int(input())):
            count += 1
    print(count)


if __name__ == "__main__":
    """
    1 <= n <= 10000
    x <= 10^8
    """
    solve()

Solution (Python):
def is_prime(n):
    n = abs(n)
    if n == 2:
        return True
    if n < 2 or n % 2 == 0:
        return False
    return pow(2, n - 1, n) == 1

cnt = 0
for i in range(int(input())):
    if is_prime(int(input())):
        cnt += 1
print(cnt)

Solution (Python):
import math

n = int(input())

nlist = []
for _ in range(n):
    nlist.append(int(input()))

ans = 0

for l in nlist:
    if l == 1:
        continue
    flag = 1
    for i in range(2, int(math.sqrt(l)) + 1):
        if l % i == 0:
            flag = 0
            break
    if flag:
        ans += 1

print(ans)

Solution (Python):
from enum import Enum
import sys
import math
 
BIG_NUM = 2000000000
MOD = 1000000007
EPS = 0.000000001
 
 
N = int(input())
 
ans = 0
 
for loop in range(N):
    num = int(input())
 
    if num == 1:
        ans += 1
    if num <= 3:
        continue
    elif num%2 == 0:
        ans += 1
    else:
        tmp_num = 3
        while True:
            if tmp_num*tmp_num > num:
                break
            if num%tmp_num == 0:
                ans += 1
                break
            tmp_num += 2
 
print("%d"%(N-ans))

Solution (Python):
def judge_prime(n):
    if n == 1:
        return False
    else:
        cnt = 2
        while cnt ** 2 <= n:
            if n % cnt == 0:
                return  False
            else:
                cnt += 1
        return  True

cnt_prime = 0

N = int(input())
for i in range(N):
    judge_num = int(input())
    if judge_prime(judge_num):
        cnt_prime += 1
        
print(cnt_prime)

Solution (Python):
def isprime(x):
    if x == 2:
        return True
    elif (x < 2) | (x%2 == 0):
        return False
    for i in range(3, int(x**0.5)+1, 2):
        if x%i == 0:
            return False
    return True


n = int(input())
count = 0
for i in range(n):
    if isprime(int(input())):
        count += 1
print(count)

Solution (Python):
import math
num=int(input())
n=[]
for i in range(num):
    b=int(input())
    if b==2 or b%2!=0:
        n.append(b)
count=0
for i in n:
    a=0
    for j in range(1,int(math.sqrt(i))+1):
        if i%j==0:
            a+=1
            if a>1:
                break
    if a==1:
        count+=1
print(count)

Solution (Python):
def isPrime(n):
    j = 2
    while j * j <= n:
        if n % j == 0:
            return False
        j += 1
    return True

if __name__ == '__main__':
    n = int(input())
    ans = 0
    for i in range(n):
        m = int(input())
        if isPrime(m):
            ans += 1
    print(ans)

Solution (Python):
N = int(input())
pn_L = [2, 3, 5] 
for i in range(7, 10000):
    for j in range(2, i):
        if i % j == 0:
            break
    else:
        pn_L.append(i)

pn = 0
for i in range(N):
    n = int(input())
    if n <= 10000:
        if n in pn_L:
            pn += 1
    else:
        sqn = round(n**0.5)
        L = [p for p in pn_L if p <= sqn]
        for j in L:
            if n % j == 0:
                break
        else:
            pn += 1
print(pn)

Solution (Python):
n=int(input())
count=0
for i in range(0,n):
    x=int(input())
    if(x==2 or x==3):
        count+=1
    elif(x%2!=0):
        d=3
        while(1):
            if(x%d!=0):
                d+=2
            else:
                break
            if(x < d*d):
                count+=1
                break
print(count)

Solution (Python):
from math import sqrt
n = int(input())
ans = 0
for i in range(n):
    x = int(input())
    ok = 1
    for z in range(2, int(sqrt(x))+1):
        if x % z == 0:
            ok = 0
            break
    ans += ok
print(ans)

Solution (Python):
import math

def isPrime(x):
    if x == 2:
        return 1
    elif x < 2 or x % 2 == 0:
        return 0
    i = 3
    while i <= math.sqrt(x):
        if x % i == 0:
            return 0
        i += 2
    return 1

arr = []
cnt = 0
            
n = int(input())
for i in range(n):
    x = int(input())
    arr.append(x)

for i in arr:
    cnt += isPrime(i)
    
print(cnt)

Solution (Python):
import sys
prime = lambda x: True if x==2 else False if x<2 or not x%2 else pow(2,x-1,x)==1
inp = sys.stdin.readlines()
print(len([prime(e) for e in list(map(int, inp[1:])) if prime(e)==1]))

Solution (Python):
def isPrimeNum(n):
    for i in range(2, int(n**(1/2))+1):
        if n%i==0: return 0
    return 1

print(sum([isPrimeNum(int(input())) for _ in range(int(input()))]))

Solution (Python):
import math

def isPrime(x):
	for i in range(2,int(math.sqrt(x))+1):
		if x%i == 0:
			return 0
	return 1

n=int(input())
ans=0
for i in range(n):
	x=int(input())
	if isPrime(x):
		ans+=1
print(ans)

Solution (Python):
def isprime(a,kore):
    for i in range(0,len(kore)):
        if a>kore[i] and a%kore[i]==0:
            return 0
    return 1

n=int(input())
cnt=0
primes=[0,]*10001
primes[2]=1
kore=[]
for i in range(2,10001):
    for j in range(i,10001,i):
        if j==i and primes[j]!=-1:
            primes[j]=1
            kore.append(j)
        else:
            primes[j]=-1
for i in range(0,n):
    a=int(input())
    cnt+=isprime(a,kore)
print(str(cnt))

Solution (Python):
n =  int(input())
index=0
count=0
while index<n:
    number = int(input())
    stock =[]
    devideN = 1
    while devideN <= number:
        if len(stock)>2:
            break
        elif devideN==10000:
            stock.append(devideN)
            break
        elif number%devideN==0:
            if devideN!=1 and devideN!=number:
                break
            else:
                stock.append(devideN)
        else:
            pass
        devideN+=1
    if len(stock) == 2:
        count+=1
    index+=1
print(count)

Solution (Python):
import math
def isprime(x):
    if x == 2:
        return True

    if x < 2 or x%2 == 0:
        return False

    for i in range(3, int(math.sqrt(x))+1, 2):
        if x % i == 0:
            return False

    return True


if __name__ == "__main__":
    n = int(input())
    ans = 0
    for i in range(n):
        if isprime(int(input())):
            ans += 1

    print(ans)

Solution (Python):
import math

def is_prime(k):
    for d in range(2, math.floor(math.sqrt(k))+1):
        if k % d == 0:
            return False
    
    return True

def main():
    N = int(input())
    ans = 0

    for i in range(N):
        k = int(input())

        if is_prime(k):
            ans += 1

    print(ans)

main()

Solution (Python):
from math import sqrt
N = int(input())
Numbers = []
for _ in range(N):
    Numbers.append(int(input()))
count = 0
for Num in Numbers:
    flag = True
    for j in range(2, int(sqrt(Num) + 1)):
        if Num % j == 0:
            flag = False
            break
    if flag:
        count += 1
print(count)

Solution (Python):
def isPrime(x):
    if x < 0:
        return False
    if x == 2:
        return True
    if x % 2 == 0:
        return False
    i = 3
    while i * i <= x:
        if x % i == 0:
            return False
        i += 2
    return True


if __name__ == '__main__':
    n = int(input())
    cnt = 0
    for i in range(n):
        x = int(input())
        if isPrime(x):
            cnt += 1
    print(cnt)