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: if nine >= 2: ans += 1 nine -= 2 else: one += 1 elif s == 9: if one: ans += 1 one -= 1 else: nine += 1 print(ans + one//2)