#!/usr/bin/env python3 # %% import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines # %% N = int(readline()) S = read().rstrip().decode() # %% S = S.replace('3', '') S = S.replace('5', '') S = S.replace('7', '') answer = N - len(S) # %% N = len(S) S = S.replace('19', '') answer += (N - len(S)) // 2 x9 = S.count('9') x1 = S.count('1') n = min(x9 // 2, x1) answer += n x1 -= n answer += x1 // 2 print(answer)