# problem 1 N = int(input()) S = list(input()) ans = 0 dic = {"1": 0, "3": 0, "5": 0, "7": 0, "9": 0} for some in S: dic[some] += 1 ans = dic["3"]+dic["5"]+dic["7"] new = {1: 0, 9: 0} for x in S: n = int(x) if n == 1: new[1] += 1 if n == 9: new[9] += 1 if new[1] > 0: new[1] -= 1 new[9] -= 1 ans += 1 if new[9] >= new[1]*2: ans += new[1] print(ans) exit() elif new[9] < new[1]*2: if new[9]>1: p = new[9]//2 ans += p new[1] -= p ans += new[1]//2 print(ans) exit() else: print(ans)