#define _USE_MATH_DEFINES #define _CRT_SECURE_NO_WARNINGS #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; //#include int main() { int r[15] = {1,0,0,0,1,0,1,0,2,1}; int n, ans = 0; cin >> n; int a = 0; if (!n) { a = 1; ans = 1; } while (n) { a += r[n % 10]; n /= 10; ans++; } cout << min(2 * (a + 1) + ans, 2 * ans + a + 1)<