N = int(input()) S = list(input()) S = list(map(int, S)) ans = S.count(3) + S.count(5) + S.count(7) one = 0 for s in S: if s == 1: one += 1 elif s == 9: if one: ans += 1 one -= 1 print(ans + one//2)