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