N = int(input()) S = input() one, nine, prime, match = 0, 0, 0, 0 for i in range(N): if S[i] in ['3', '5', '7']: prime += 1 elif S[i] == '1': one += 1 elif S[i] == '9': if one > 0: one -= 1 match += 1 else: nine += 1 if one >= nine//2: print(prime+match+nine//2+(one-nine//2)//2) else: print(prime+match+one)