#include using namespace std; int main() { const int beet[] = {3, 1, 1, 1, 3, 1, 3, 1, 5, 3}; const int malta[] = {3, 2, 2, 2, 3, 2, 3, 2, 4, 3}; string S; cin >> S; int ret = 2, ret2 = 1; for(auto &c : S) ret += beet[c - '0']; for(auto &c : S) ret += malta[c - '0']; cout << min(ret2, ret) << endl; }