#include using namespace std; int main() { int N; cin >> N; vector V = {1,0,0,0,1,0,1,0,2,1}; int ans = to_string(N).size() * 2 + 1; while (N) ans += V.at(N % 10), N /= 10; cout << ans << "\n"; }