# Arup Guha
# 11/5/2025
# Solution to 2025 SER D1/D2 Problem J: Game of Nines

# Solves problem with frequency array of input and # of values.
def solve(freq, n):

    # You can use any of these to get rid of the rest.
    for i in [1,3,7,9]:
        if freq[i] > 0:
            return 1

    # If there is a 5, we have two cases.
    if freq[5] > 0:

        # We can use the 5 and even number together.
        if (freq[2]+freq[4]+freq[6]+freq[8] > 0):
            return 1

        # 5 and 0s can't make it.
        else:
            return n

    # No other cases work.
    return n

# Get input.
n = int(input())

freq = []
for i in range(10):
    freq.append(0)

# Store as frequency.
for i in range(n):
    freq[int(input())] += 1

# Solve.
print(solve(freq, n))

