#include<time.h>
#include<iostream>
using namespace std;





int main(){
	unsigned long d,V,i=0;
	scanf("%lu",&V);
	while(V){
		d=V%10;
		if(d==5 || d==2 || d==1)i++;
		else if(d==3 || d==4 || d==6 || d==7)i+=2;
		else if(d>7)d+=3;
		V=V/10;
	}
	printf("\n%lu",i);
	return 0;
}