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

typedef struct Leaf {
	int value;
	struct Leaf *prev;
	struct Leaf *next;
} Leaf;

typedef struct LinkList {
	Leaf *head;
	Leaf *tail;
} LinkList;

typedef struct PrimeInfo {
	int progress;
	LinkList list;
} PrimeInfo;

void update_prime_info(PrimeInfo *p_info, int new_value){
	Leaf *curr;
	int found;

	if( new_value >= 2 ){
		while(p_info->progress < new_value){
			p_info->progress++;
			// Check Divide Possiblity
			found = 0;
			curr = p_info->list.head;
			while(curr != NULL){
				if( (p_info->progress % curr->value) == 0 ){
					found = 1;
					break;
				}
				curr = curr->next;
			}
			if(!found){
				curr = malloc(sizeof(Leaf));
				curr->value = p_info->progress;
				if( p_info->list.tail == NULL ){
					curr->prev = curr->next = NULL;
					p_info->list.head = p_info->list.tail = curr;
				} else {
					p_info->list.tail->next = curr;
					curr->prev = p_info->list.tail;
					curr->next = NULL;
					p_info->list.tail = curr;
				}
			}
		}
	}
}

int is_prime(PrimeInfo *p_info, int new_value){
	Leaf *curr;

	if( new_value <= p_info->progress/2 ){
		// If Small Number, Search From Head
		curr = p_info->list.head;
		while( curr != NULL ){
			if( curr->value == new_value ){
				return 1;
			}
			curr = curr->next;
		}
	} else {
		// If Big Number, Search From Tail
		curr = p_info->list.tail;
		while( curr != NULL ){
			if( curr->value == new_value ){
				return 1;
			}
			curr = curr->prev;
		}
	}

	return 0;
}

int main(int argc, char** argv){
	int n,value;
	PrimeInfo info;
	int count;

	// Init Prime Info
	info.progress = 1;
	info.list.head = NULL;
	info.list.tail = NULL;
	// Init Count
	count = 0;

	// Input n
	scanf("%d",&n);
	while(n-- > 0){
		// Input Value
		scanf("%d",&value);
		// Update Pfine Info
		update_prime_info(&info,value);
		// Check Prine Info
		if( is_prime(&info,value) ){
			count++;
		}
	}

	// Output
	printf("%d\n",count);

	return 0;
}