#include <bits/stdc++.h>
using namespace std;
int main() 
{
string s;
cin>>s;
char n[100];
strcpy(n,s.c_str());
long long d,br=0; 
for(int i=0;i<s.length();i++)
{
d=n[i]-48;
if(d==0)
br+=0;
else if(d==1||d==2||d==5)
br+=1;
else if(d==4||d==3||d==6||d==7)
br+=2;
else
br+=3;
} 
cout<<br<<endl;
return 0;
}