#include<bits/stdc++.h>
#define int long long
using namespace std;

int n, ans;

signed main(){
	ios_base::sync_with_stdio(0);
	cout.tie(0);
	cin.tie(0);
	cin >> n;
	while(n){
		int tmp = n%10;
		n /= 10;
		if(tmp == 0){
			continue;
		}
		if(tmp == 1 or tmp == 2 or tmp == 5){
			++ans;
		} else if(tmp == 2 or tmp == 3 or tmp == 4 or tmp == 6 or tmp == 7){
			ans += 2;
		} else {
			ans += 3;
		}
	}
	cout << ans;
}