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 count = 0; ArrayList list = new ArrayList<>(); for (char c : arr) { if (c == '3' || c == '5' || c == '7') { count++; } else { list.add(c - '0'); } } int oneCount = 0; int nineCount = 0; for (int x : list) { if (x == 1) { oneCount++; } else { if (oneCount > 0) { count++; oneCount--; } else { nineCount++; } } } count += oneCount / 2; System.out.println(count); } }