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(); ArrayList list = new ArrayList<>(); int count = 0; for (char c : arr) { if (c == '3' || c == '5' || c == '7') { count++; } else { list.add(c - '0'); } } int length = list.size(); int[] sums1 = new int[length]; for (int i = 0; i < length; i++) { if (i != 0) { sums1[i] = sums1[i - 1]; } if (list.get(i) == 1) { sums1[i]++; } } int max = 0; int sum9 = 0; for (int i = length - 1; i >= 0 && sum9 <= sums1[i]; i--) { max = sum9; if (list.get(i) == 9) { sum9++; } } count += max; if (length > 0) { count += (sums1[length - 1] - max) / 2; } System.out.println(count); } }