#include<stdio.h>
#define ll long long
int f(int x)
{
	if(x==0) return 0;
	if(x==1 || x==2 || x==5) return 1;
	if(x==3 || x== 4 || x==6 || x==7) return 2;
	return 3;
}
main()
{
	ll n;
	int sum=0;
	scanf("%lld",&n);
	for(;n>0;n/=10) sum+=f(n%10);
	printf("%d",sum);
}