using System; class Program { Scanner cin; int N; string S; void myon() { cin = new Scanner(); N = cin.nextInt(); S = cin.next(); int one = 0, nine = 0, other = 0; for(int i = 0; i < N; i++) { if(S[i] == '3' || S[i] == '5' || S[i] == '7') { other += 1; } else if(S[i] == '1') { one += 1; } else { if(one > 0) { one -= 1; other += 1; } else { nine += 1; } } } int make = Math.Min(one, nine / 2); Console.WriteLine(other + make + (one - make) / 2); } static void Main(string[] args) { new Program().myon(); } } class Scanner { string[] s; int i; readonly char[] cs = new char[] { ' ' }; public Scanner() { s = new string[0]; i = 0; } public string next() { if (i < s.Length) return s[i++]; string st = Console.ReadLine(); while (st == "") st = Console.ReadLine(); s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries); if (s.Length == 0) return next(); i = 0; return s[i++]; } public string nextLine() { return Console.ReadLine(); } public int nextInt() { return int.Parse(next()); } public long nextLong() { return long.Parse(next()); } public double nextDouble() { return double.Parse(next()); } }