#!/bin/python import sys def primes(n): """ Returns a list of primes < n """ sieve = [True] * n for i in xrange(3,int(n**0.5)+1,2): if sieve[i]: sieve[i*i::2*i]=[False]*((n-i*i-1)/(2*i)+1) return [2] + [i for i in xrange(3,n,2) if sieve[i]] def primesLessThanAMillion(): return primes(1000000) def longestSequence(a): # any divisor of n (other than n) is necessarily less than sqrt(n) # any divisor which is not a prime is necessarily divisible by a prime primeList = primesLessThanAMillion() total = 0 for barLength in a: currentBarLength = barLength testDivisorIndex = primeList.__len__()-1 subParts = 1 while testDivisorIndex >= 0 and currentBarLength > 1: testDivisor = primeList[testDivisorIndex] if (currentBarLength % testDivisor) == 0: currentBarLength /= testDivisor total += subParts subParts *= testDivisor else: testDivisorIndex -= 1 total += barLength return total if __name__ == "__main__": n = int(raw_input().strip()) a = map(long, raw_input().strip().split(' ')) result = longestSequence(a) print result