import java.util.*; public class Main { public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); char[] arr = sc.next().toCharArray(); int[] counts = new int[10]; StringBuilder sb = new StringBuilder(); for (char c : arr) { counts[c - '0']++; if (c == '1' || c == '9') { sb.append(c); } } int total = counts[3] + counts[5] + counts[7]; HashSet set = new HashSet<>(); for (int i = 0; i < sb.length(); i++) { if (sb.charAt(i) == '9' || set.contains(i)) { continue; } boolean flag = false; for (int j = i + 1; j < sb.length(); j++) { if (sb.charAt(j) == '9') { flag = true; set.add(j); total++; break; } } if (flag) { continue; } for (int j = i + 1; j < sb.length(); j++) { if (sb.charAt(j) == '1') { set.add(j); total++; break; } } } System.out.println(total); } }