import sys sys.setrecursionlimit(10 ** 6) int1 = lambda x: int(x) - 1 def main(): n = int(input()) s = input() ans = 0 c1 = c9 = 0 flag = False for c in s: if c == "3" or c == "5" or c == "7": ans += 1 if c == "1": c1 += 1 if c9 > 1: flag = True if c == "9": c9 += 1 ans += c1 // 2 if c1 % 2 and flag: ans += 1 print(ans) main()