#include <bits/stdc++.h>

int novac(char c){
	if(c=='0')return 0;
	if(c=='1' || c=='2' || c=='5')return 1;
	if(c=='8'||c=='9')return 3;
	return 2;
}

int main() {
	string s;
	cin>>s;
	int sum=0, n=s.length();
	for(int i=0; i<n; i++)k+=novac(s[i]);
	cout<<k;
	return 0;
}