import java.util.;
import java.io.;
public class ss {
public static void main(String[] args) {
Scanner sc = new Scanner (System.in);
int n;
n=sc.nextInt();
sc.nextLine();
String a,b;
a=sc.nextLine();
int counter=0;
int [] arr= {2,3,5,7,11,13,17,19,23,29};
for(int i=0;i<a.length();i++) {
for(int j=i+1;j<=a.length();j++) {
String ss = "";
ss=a.substring(i,j);
int no = Integer.parseInt(ss);
//System.out.println(no); //optional
if(no==0 || no==1) {
continue;
}
else {
for(int l=0;l<arr.length;l++) {
if(arr[l]==no) {
counter++;
i=j+1;
j=a.length();
}else if(no>29) {
for(int d=0;d<arr.length;d++) {
if(no%arr[d]!=0)
counter++;
}
}
}
}
}
}
System.out.println(counter);
}
}