n = int(input()) s = input() from collections import defaultdict count = defaultdict(int) for c in s: count[c] += 1 ans = 0 # Step 1: Count 1-digit primes (3, 5, 7) ans += count['3'] + count['5'] + count['7'] count['3'] = 0 count['5'] = 0 count['7'] = 0 # Step 2: Form as many 11 as possible x = count['1'] ans += x // 2 remaining_ones = x % 2 count['1'] = remaining_ones # Step 3: Form primes with 1 and 9 (19) possible_pairs = min(count['1'], count['9']) ans += possible_pairs print(ans)