#include <iostream>

using namespace std;

int main()
{  unsigned long long int x;
    cin >> x;
    int r=0;
     while(x!=0)
            {
                switch(x%10)
                {
                    case 1:
                        { r += 1;}
                    break;

                    case 2:
                        { r += 1; }
                        break;

                    case 3:
                        { r += 2; }
                        break;

                    case 4:
                        { r += 2; }
                        break;

                    case 5:
                        { r += 1; }
                        break;

                    case 6:
                        { r += 2; }
                        break;

                    case 7:
                        { r += 2; }
                        break;

                    case 8:
                        { r += 3; }
                        break;

                    case 9:
                        { r += 3; }
                        break;

                    case 0:
                        { r += 0; }
                        break;

                }
                x /= 10;
            }
            cout<<r;
    return 0;
}