import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int[] num = new int[10]; int r = 0; for(int i = 0; i < 10; i++) { int d = n % 10; num[d]++; r++; n /= 10; if(n == 0) break; } int ans = 2 * r + 1; for(int i = 0; i < 10; i++) { if((i == 0) || (i == 4) || (i == 6) || (i == 9)) ans += (num[i]); if(i == 8) ans += (2 * num[i]); } System.out.println(ans); } }