long n,i,h,c;s[6<<25];f(long j){for(;j;j/=10)h=(h*10007+j%10)%200000033;}main(){for(scanf("%ld",&n);++i*i<=n;)n%i<1?h=0,f(i),f(n/i),c+=!s[h]++,h=0,f(n/i),f(i),c+=!s[h]++:0;printf("%d",c);}