#include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair Pr; int n; int ans; int main() { cin >> n; string s = to_string(n); for (int i = 0; i < s.size(); i++) { if (s[i] == '6' || s[i] == '4' || s[i] == '9' || s[i] == '0') ans += 3; else if (s[i] == '8') ans += 4; else ans += 2; } cout << ans+1 << endl; return 0; }