from fractions import gcd from datetime import date, timedelta from heapq import* import math from collections import defaultdict, Counter, deque import sys from bisect import * import itertools import copy sys.setrecursionlimit(10 ** 7) MOD = 10 ** 9 + 7 def main(): n = int(input()) s = list(input()) s2 = [] ans = 0 for i in range(n): if s[i] == "3" or s[i] == "5" or s[i] == "7": ans += 1 else: s2.append(s[i]) one, nine = 0, 0 for i in range(len(s2)): if s2[i] == "1": one+=1 elif s2[i] == "9": if one > 0: ans += 1 one -= 1 ans += (one // 2) print(ans) if __name__ == '__main__': main()