#include <iostream>
#include <math.h>

using namespace std;

int counter(unsigned long long int broj) {
	int counter = 0;
	for (int i = broj; i > 0 ; i = i / 10) {
		counter++;
	}
	return counter;
}
void cifre(unsigned long long int broj, unsigned long long int array[], int counter) {
	int brojTemporary = broj;
	for (int i = 0; i < counter; i++) {
		
		array[i] = brojTemporary % 10;
		brojTemporary = brojTemporary / 10;

	}

}
int main() {
	unsigned long long int broj;
	cin >> broj;
	unsigned long long int array [17];

	int brojCifara = counter(broj);

	cifre(broj, array, brojCifara);
	int counter = 0;
	for (int i = 0; i < brojCifara; i++) {
		if (array[i] == 0)counter += 0;
		else if (array[i] == 1)counter +=1;
		else if (array[i] == 2)counter +=1;
		else if (array[i] == 3)counter +=2;
		else if (array[i] == 4)counter +=2;
		else if (array[i] == 5)counter +=1;
		else if (array[i] == 6)counter +=2;
		else if (array[i] == 7)counter +=2;
		else if (array[i] == 8)counter +=3;
		else if (array[i] == 9)counter +=3;
	}
	cout << counter << endl;
	
	system("PAUSE");
}