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