#include <iostream>
#include <algorithm>
#include <iomanip>


using namespace std;

int main()
{
	int  c, j,n;
	int g,k,l,p,s,z;
	
	z = 0;
	k = 0;
	
	s = 1;
	 cin >> n;
	 for (l=n;l<1;l=l/10)
	 {
		 s = s * 10;
	 }
	 for(p=n;p==0;s=s/10)
	 {
		 g = (p - p % s)/s;
		 if (g = 3) k = 2; else
			 if (g = 4) k = 2; else
				 if (g = 6) k = 2; else
					 if (g = 7) k = 2; else
						 if (g = 8) k = 3; else
							 if (g = 0) k = 0; else

							 if (g = 9) k = 3; else
								 k = 1;
		 z = z + k;
		 p = p % s;
		 
	 }
	 cout << z;
	 
	}