After a long vacation due to Swine Flu, 1st Year SVNIT students have returned back to Gajjar Bhavan. Students in Gajjar Bhavan generally handshake to greet each other but due to Swine Flu it's still risky to handshake so students greet each other by just words instead of handshakes.

Bagha is an interesting(really?) Maggu. He considers a greet interesting if the word spoken by a guy is palindrome and the length of the word is prime. Help, Bagha find out the number of interesting greets other students have given to him.

Input Format :
Input starts with N denoting the number of greets given to Bagha.
Next N lines contains a string(without space) each in lowercase having the greets.

Output Format :
Output the number of greets which are both palindromes and prime in length.

Constraints :
1 ≤ N ≤ 10
1 ≤ Length of string ≤ 1000

Problem Setter : Swastik Mundra

SAMPLE INPUT
3
hellolleh
naman
racecar

SAMPLE OUTPUT
2
def isprime(num):
	if num < 2: return False
	if num == 2: return True
	for i in range(2,int(num**0.5)+1):
		if num%i == 0:
			return False
	return True

def ispal(s):
	for i in range(0,len(s)/2):
		if s[i] != s[len(s)-i-1]:
			return False
	return True

n = input()
count = 0
while n:
	s = raw_input()
	if isprime(len(s)):
		if ispal(s):
			count += 1
	n -= 1
print count