#include #include using namespace std; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); string S; cin >> S; uint16_t i, j, ans = 0; uint32_t k; uint64_t sum, cur; for (i = 0; i != UINT16_C(1) << (S.size() - 1); ++i) { cur = S[0] - '0', sum = 0; for (j = 0; j != S.size() - 1; ++j) { if ((i >> j) & 1) cur *= 10; else sum += cur, cur = 0; cur += S[j + 1] - '0'; } sum += cur; for (k = 2; static_cast(k) * k <= sum; ++k) if (sum % k == 0) break; if (static_cast(k) * k > sum) ++ans; } cout << ans << '\n'; return 0; }