n = int(input()) s = input().strip() count_357 = 0 remaining = [] for c in s: if c in {'3', '5', '7'}: count_357 += 1 else: remaining.append(c) count_1 = 0 count_19 = 0 for c in remaining: if c == '1': count_1 += 1 elif c == '9': if count_1 > 0: count_19 += 1 count_1 -= 1 count_11 = count_1 // 2 total = count_357 + count_19 + count_11 print(total)