#include <iostream>
#include <cmath>

using namespace std;

int main() 
{
    unsigned long long n ;
    unsigned long long sum = 0 ;
    
    cin >> n ;

    while ( n != 0 )
    {
        int rad = 
        % 10 ;
        if ( rad == 1 ) { sum++ ; }
        else if ( rad == 2 ) { sum ++ ; }
        else if ( rad == 3 ) { sum += 2 ; }
        else if ( rad == 4 ) { sum += 2 ; }
        else if ( rad == 5 ) { sum ++ ; }
        else if ( rad == 6 ) { sum += 2 ; }
        else if ( rad == 7 ) { sum += 2 ; }
        else if ( rad == 8 ) { sum += 3 ; }
        else if ( rad == 9 ) { sum += 3 ; }
        
        n = n / 10 ;
    }
    cout << sum ;
}