import sys #input = sys.stdin.readline #input = sys.stdin.buffer.readline def prime_factorize(n): ret = [] #if n == 1: # ret.append((1,1)) # return ret cnt = 0 while n % 2 == 0: cnt += 1 n //= 2 if cnt > 0: ret.append((2,cnt)) i = 3 while i * i <= n: cnt = 0 while n % i == 0: cnt += 1 n //= i else: if cnt != 0: #cnt==0の時は追加しない ret.append((i,cnt)) i += 2 if n != 1: ret.append((n,1)) return ret #(素因数、何乗) def main(): S = str(input()) N = len(S) ans = 0 for i in range(1<<(N-1)): calc = [] for j in range(N-1): calc.append(S[j]) if (i>>j)&1 == 1: calc.append('+') calc.append(S[N-1]) val = eval("".join(calc)) if val == 1: continue L = prime_factorize(val) #print(val,L) if L == [(val,1)]: ans += 1 print(ans) if __name__ == '__main__': main()