n=int(input())
a=list(map(int,input().split()))
c2=0
c3=0
c5=0
for i in a:
    x=i
    while x%2==0:
        c2+=1
        x//=2
    while x%3==0:
        c3+=1
        x//=3
    while x%5==0:
        c5+=1
        x//=5
print(min(c2,c3,c5))