S = input().strip() K = len(S) ans = 0 if S!="1": for n in range(1<<(K-1)): T = S[:] for k in range(K-1): if (n>>k)&1: T = T[:K-2-k+1]+"+"+T[K-2-k+1:] x = eval(T) flag =True for i in range(2,x+1): if i*i>x:break if x%i==0: flag = False break if flag: ans += 1 print(ans)