#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string N; cin >> N; int len = (int)(N.size()); vector A; for (int bit = 0; bit < (1 << (len - 1)); bit++) { long long sum = 0; string T; for (int i = 0; i < len; i++) { T += N[i]; if ((bit & (1 << i)) || (i == len - 1)) { sum += stoll(T); T = ""; } } A.push_back(sum); } int ans = 0; for (int i = 0; i < (int)(A.size()); i++) { bool flg = true; for (long long j = 2; j * j <= A[i]; j++) { if (A[i] % j == 0) { flg = false; } } if (flg) { ans++; } } cout << ans << endl; return 0; }