#include using namespace std; int main(){ string S; cin >> S; int N = S.size(); int ans = 0; for (int i = 0; i < (1 << (N - 1)); i++){ long long x = S[0] - '0'; long long sum = 0; for (int j = 0; j < N - 1; j++){ if ((i >> j & 1) == 1){ sum += x; x = 0; } x = x * 10 + (S[j + 1] - '0'); } sum += x; if (sum > 1){ bool ok = true; for (long long j = 2; j * j <= sum; j++){ if (sum % j == 0){ ok = false; } } if (ok){ ans++; } } } cout << ans << endl; }