#include using namespace std; using ll = long long; using P = pair; #define rep(i, n) for(int i = 0; i < n; i++) #define all(x) (x).begin(),(x).end() int main(){ int MAX_N = 100100; vector PNJudge(MAX_N,true); vector pn; PNJudge[1] = false; for(int i=2;i> s; if(s=="1"){ cout << 0 << endl; return 0; } int n = s.size(), ans = 0; rep(i,1<<(n-1)){ int ic = i, be = 0; ll x = 0; rep(j,n-1){ if(ic&1){ x += stol(s.substr(be,j+1-be)); be = j+1; } ic >>= 1; } x += stol(s.substr(be,n-be)); bool ok = true; for(ll p:pn){ if(!(x%p) && x/p != 1) ok = false; } ans += ok; } cout << ans << endl; return 0; }