n = int(input()) s = list(str(input())) ans = 0 cnt1 = 0 cnt9 = 0 for c in s: if c == '3' or c == '5' or c == '7': ans += 1 elif c == '9': if cnt1: cnt1 -= 1 ans += 1 else: cnt9 += 1 else: cnt1 += 1 q = cnt9//2 ans += min(q, cnt1) cnt1 -= min(q, cnt1) ans += cnt1//2 print(ans)