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



int main()
{
    int brojNovcanica[]={0,1,1,2,2,1,2,2,3,3};
    string v;
    int brojac=0;
    cin  >> v;
    for(int i=0;i<v.length();i++) brojac+=brojNovcanica[v[i]-48];
    cout << brojac;
    return 0;
}