#include<bits/stdc++.h>
using namespace std;
long long d,a[5000005],tren,brnovcanica;
string v;
int main()
{
    cin>>v;
    for(int i=0;i<v.size();i++)
    {
        a[v[i]-48]++;
    }
    for(int i=1;i<=9;i++)
    {
        if(i==1)
        {
            brnovcanica+=a[i]*1;
        }
        if(i==2)
        {
            brnovcanica+=a[i]*1;
        }
        if(i==3)
        {
            brnovcanica+=a[i]*2;
        }
        if(i==4)
        {
            brnovcanica+=a[i]*2;
        }
        if(i==5)
        {
            brnovcanica+=a[i]*1;
        }
        if(i==6)
        {
            brnovcanica+=a[i]*2;
        }
        if(i==7)
        {
            brnovcanica+=a[i]*2;
        }
        if(i==8)
        {
            brnovcanica+=a[i]*3;
        }
        if(i==9)
        {
            brnovcanica+=a[i]*3;
        }
    }
    cout<<brnovcanica<<endl;
    return 0;
}