#include <iostream>
#include <cmath>
using namespace std ;

/* run this program using the console pauser or add your own getch, system("pause") or input loop */

int f1 (int x) {
    switch(x)
	case(x = 1){
		return 1;
		break;
	}
	case(x = 2){
		return 1;
		break;
	}
	case(x = 3){
		return 2;
		break;
	}
	case(x = 4){
		return 2;
		break;
	}
	case(x = 5){
		return 1;
		break;
	}
	case(x = 6){
		return 2;
		break;
	}
	case(x = 7){
		return 2;
		break;
	}
	case(x = 8){
		return 3;
		break;
	}
	case(x = 9){
		return 3;
		break;
	}
	case(x = 0){
		return 0;
		break;
	}
}




int f (int n) {
	int x;
	int b1 = 0;
	int k = 0;
	while (n >= pow(10,k)){
		x = (n / (int)pow(10,k)) % 10;
		b1 = b1 + f1(x);
		k = k + 1;
	}
	return (b1);
}




int main(int argc, char** argv) {
	int v,b;
	cin >> v;
    b = f (v);
    cout << b << endl;
	
	return 0; 
}