#include <stdio.h>
#include <stdlib.h>
#include <math.h>

int main(void)
{
	int N, isOne, max, root, i, ans;
	int *prime, *exists;

	scanf("%d\n", &N);
	int nums[N];
	max = 0;
	isOne = 0;
	for (i = 0; i < N; i++)
	{
		scanf("%d", &nums[i]);
		if (max < nums[i])
			max = nums[i];
		if (nums[i] == 1)
			isOne = 1;
	}

	// 1がある場合
	if (isOne && 1 < N)
	{
		printf("0\n");
		return (0);
	} else if (isOne)
	{
		printf("1\n");
		return (0);
	}

	prime = (int *)calloc(max + 1, sizeof(int));
	if (prime == 0)
		return (1);
	prime[0] = 1;
	prime[1] = 1;
	i = 2;
	if (prime[i] == 0)
	{
		int j = 4;
		while (j <= max)
		{
			prime[j] = 1;
			j += i;
		}
	}
	i = 3;
	root = sqrt(max + 1) + 1;
	while (i < root)
	{
		if (prime[i] == 0)
		{
			int j = i * i;
			while (j <= max)
			{
				prime[j] = 1;
				j += i;
			}
		}
		i += 2;
	}

	exists = (int *)calloc(max + 1, sizeof(int));
	if (exists == 0)
		return (1);
	i = 0;
	while (i < N)
	{
		exists[nums[i]]++;
		i++;
	}

	ans = 0;
	i = 0;
	while (i < N)
	{
		if (2 <= exists[nums[i]])
		{
			i++;
			continue;
		}
		if (prime[nums[i]] == 0)
		{
			ans++;
			i++;
			continue;
		}
		int j = 2;
		int flg = 0;
		while (j < nums[i])
		{
			if (nums[i] % j == 0 && 0 < exists[j])
				flg = 1;
			if (flg)
				j = nums[i];
			else
				j++;
		}
		if (flg == 0)
			ans++;
		i++;
	}
	printf("%d\n", ans);
	return (0);
}