import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); 
		long v=Long.parseLong(br.readLine()); 
		long n=0;
		while(v>0) {
			long k = String.valueOf(v).length();
			long a=(long) (v/Math.pow(10, k-1));
			if(a==1 | a==2 | a==5) {
				n+=1;
			}
			else if(a==3 | a==4 | a==6 | a==7) {
				n+=2;
			}
			else if(a==8 | a==9) {
				n+=3;
			}
			v-=a*Math.pow(10, k-1);
		}
		System.out.println(n);	
	}
}