#include using namespace std; const set st = {0, 4, 6, 9}; int main() { int n; cin >> n; int ans = 0; while (n) { ans += 3; int cd = n % 10; if (st.count(n)) ans++; else if (n == 8) ans += 2; n /= 10; } cout << ans << endl; return (0); }