#include <iostream>
using namespace std;
int main() {
  long int sum, remainder,n, digit,br;
  cin>>n;
  br=0;
  while (n>0) {
        remainder = n%10;
        sum = sum + remainder;
        digit = n%10;
        n = n/10;
        if (digit==1)
        {
          br=br+1;
        }
        if (digit==2)
        {
          br=br+1;
        }
        if (digit==3)
        {
          br=br+2;
        }
        if (digit==4)
        {
          br=br+2;
        }
        if (digit==5)
        {
          br=br+1;
        }
        if (digit==6)
        {
          br=br+2;
        }
        if (digit==7)
        {
          br=br+2;
        }
        if (digit==8)
        {
          br=br+3;
        }
        if (digit==9)
        {
          br=br+3;
        }
        }
cout<<br ;
        
    return 0;
}