#include <iostream>
#define ll long long
using namespace std;

ll i;
short j;
int c = 0;

int main(){
    cin >> i;
    while(i){
        j = i % 10;
        switch(j){
            case 0:
                break;
            case 1:
            case 2:
            case 5:
                c += 1;
                break;
            case 3:
            case 4:
            case 6:
            case 7:
                c += 2;
                break;
            case 8:
            case 9:
                c += 3;
                break;
        }
        i /= 10;
    }
    cout << c << endl;
    return 0;
}