#include <bits/stdc++.h>
#define ll long long 			//-+ 9,223,372,036,854,775,807  = 9.2*10^18 = 2^63 - 1
#define ull unsigned long long	// +18,446,744,073,709,551,615  = 1.8*10^19 = 2^64 - 1
#define l long					//-+ 			 2,147,483,647	= 2.1*10^9  = 2^31 - 1
#define ul unisgned long		// +			 4,294,967,295	= 4.3*10^9	= 2^32 - 1
#define db double
#define ldb long double
#define ff(i,n) for(int i = 0; i < n; ++x)
#define fff(i,a,b) for(int i = a; i<=b; ++i)

using namespace std;
ll vre=0;
int bazza[30];
int br=0;


int main(){

	
	cin>>vre;
		for (int i = 0; i < 30; i++)
{
    bazza[i] = vre % 10;
    vre = vre / 10;
}

for(int i=0; i<20; i++){
	if(bazza[i]==1){
		br=br+1;
	}
	else if(bazza[i]==2){
		br=br+1;
	}
	else if(bazza[i]==3){
		br=br+2;
	}
	else if(bazza[i]==4){
		br=br+2;
	}
	else if(bazza[i]==5){
		br=br+1;
	}
	else if(bazza[i]==6){
		br=br+2;
	}
	else if(bazza[i]==7){
		br=br+2;
	}
	else if(bazza[i]==8){
		br=br+3;
	}
	else if(bazza[i]==9){
		br=br+3;
	}
	else if(bazza[i]==0){
		br=br+0;
	}
	
}

	cout<<br;
		

	return 0;
}