#include #include #include int main() { int cnt[10] = { 1, 0, 0, 0, 1, 0, 1, 0, 2, 1 }; std::string s; std::cin >> s; int ans1 = 1; for (char c : s) { ans1 += cnt[c - '0'] + 2; } int ans2 = 2; for (char c : s) { ans2 += cnt[c - '0'] * 2 + 1; } std::cout << std::min(ans1, ans2) << std::endl; }