#include <iostream>
#include <string>

using namespace std;
int main(int argc, char** argv) {
	string V;
	cin >> V;
	int k;
	int s=0;
	for(int i=0;i<V.length();i++)
	{
		switch(V[i])
		{
			case '0':	k=0;
				break;
			case '1':	k=1;
				break;
			case '2':	k=1;
				break;
			case '3':	k=2;
				break;
			case '4':	k=2;
				break;
			case '5':	k=1;
				break;
			case '6':	k=2;
				break;
			case '7':	k=2;
				break;
			case '8':	k=3;
				break;
			case '9':	k=3;
				break;
		}
		s+=k;
	}
	cout<<s;
	
	return 0;
}