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

int main() {
    int niz[] = {0, 1, 1, 2, 2, 1, 2, 2, 3, 3};
    
    string br;
    
    cin >> br;
    
    int n = br.length(), k = 0;
    
    for (int i = 0; i < n; i++) k += niz[br[i] - '0'];
    
    cout << k << endl;
    
    return 0;
}