#define _USE_MATH_DEFINES #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 num; 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') num++; else if (s[i] == '8') num+=2; } if (s.size() > 1) ans = (num + 1) * 2 + s.size(); else{ ans = num + 1 + s.size(); if(num == 0)ans++; } cout << ans << endl; return 0; }