#include <iostream>
using namespace std;
int oglindit(int x){
int o = 0;
while(x)
{
o = o * 10 + x % 10;
x /= 10;
}
return o;}
int cmmdc(int a, int b){
int r;
while(b)
{
r = a % b;
a = b;
b = r;
}
return a;}
int main(){
int n, cnt = 0, x;
cin>>n;
while(n)
{
cin>>x;
if(cmmdc(x, oglindit(x)) == 1)
{
cnt++;
}
n--;
}
cout<<cnt;}