#include <iostream>

int main(int argc, char** argv) {
	unsigned long long V;
	unsigned long long lluSuma = 0;
	scanf("%llu", &V);
	while(V != 0) {
		int x = V % 10;
		switch(x) {
			case 0:
				break;
			case 1:
				lluSuma += 1;
				break;
			case 2:
				lluSuma += 1;
				break;
			case 3:
				lluSuma += 2;
				break;
			case 4:
				lluSuma += 2;
				break;
			case 5:
				lluSuma += 1;
				break;
			case 6:
				lluSuma += 2;
				break;
			case 7:
				lluSuma += 2;
				break;
			case 8:
				lluSuma += 3;
				break;
			case 9:
				lluSuma += 3;
				break;
			default:
				break;
		}
		V /= 10;
	}
	printf("%llu", lluSuma); 
	return 0;
}