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