#include <stdio.h>
#include <stdlib.h>

using namespace std;

int main(){
	long V,s;
	s=0;
	scanf("%ld",&V);
	while(V!=0){
		switch(V%10){
			case 1: s+=1;break;
			case 2: s+=1;break;
			case 3: s+=2;break;
			case 4: s+=2;break;
			case 5: s+=1;break;
			case 6: s+=2;break;
			case 7: s+=2;break;
			case 9: s+=3;break;
			case 8: s+=3;break;
		}
		V=V/10;
	}
	printf("%ld",s);
}