#!/bin/python import sys def longestSequence(a): s=0 x=0 for i in xrange(len(a)): x+=a[i] while(a[i]>1): if(a[i]%2!=0 and a[i]%3!=0 and a[i]%5!=0 and a[i]%7!=0 and a[i]>7): s+=1 break elif(a[i]%2==0): s+=(a[i]/2) a[i]/=2 elif(a[i]%7==0): s+=(a[i]/7) a[i]/=7 elif(a[i]%5==0): s+=(a[i]/5) a[i]/=5 elif(a[i]%3==0): s+=(a[i]/3) a[i]/=3 return s+x # Return the length of the longest possible sequence of moves. if __name__ == "__main__": n = int(raw_input().strip()) a = map(long, raw_input().strip().split(' ')) result = longestSequence(a) print result