#include using namespace std; typedef long long ll; int main(void) { string s; cin >> s; int ans = s.size() * 2 + 1; for (int i; i < s.size(); i++) { switch((int)s[i] - 48) { case 0: { ans++; break; } case 4: { ans++; break; } case 6: { ans++; break; } case 8: { ans+=2; break; } case 9: { ans++; break; } } } cout << ans << endl; return 0; }