#include using namespace std; string s; int n, m = 0; bool f; int main() { cin >> s; n = s.size(); for (int i = 0; i < (1 << (n - 1)); i++) { long long t = 0, u = s[0] - '0'; for (int j = 0; j < n - 1; j++) { if (i & (1 << j)) { t += u; u = s[j + 1] - '0'; } else { u = u * 10 + s[j + 1] - '0'; } } t += u; if (t > 1) { f = 0; for (long long j = 2; j <= sqrt(t); j++) { if (t % j == 0) { f = 1; break; } } if (!f) { m++; } } } cout << m << endl; }