import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long v=sc.nextLong();
		long n=0;
		while(v>0) {
			long k = String.valueOf(v).length();
			int a=(int) (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);	
	}
}