#!/bin/python3 import sys def rwh_primes2(n): # https://stackoverflow.com/questions/2068372/fastest-way-to-list-all-primes-below-n-in-python/3035188#3035188 """ Input n>=6, Returns a list of primes, 2 <= p < n """ correction = (n%6>1) n = {0:n,1:n-1,2:n+4,3:n+3,4:n+2,5:n+1}[n%6] sieve = [True] * (n/3) sieve[0] = False for i in xrange(int(pow(n,0.5))//3+1): if sieve[i]: k=3*i+1|1 sieve[ ((k*k)/3) ::2*k]=[False]*((n/6-(k*k)/6-1)/k+1) sieve[(k*k+4*k-2*k*(i&1))/3::2*k]=[False]*((n/6-(k*k+4*k-2*k*(i&1))/6-1)/k+1) return [2,3] + [3*i+1|1 for i in xrange(1,n/3-correction) if sieve[i]] def prime_factors(n): """Returns all the prime factors of a positive integer""" factors = [] for d in X: while n % d == 0: factors.append(d) n /= d if d*d > n: if n > 1: factors.append(n) break return factors def m(L): if len(L)==0: return 1 return long(1 + L[-1]*m(L[0:-1])) def moves(i): if i==1: return 1 p = prime_factors(i) return m(p) def longestSequence(a): # Return the length of the longest possible sequence of moves. return long(sum(moves(i) for i in a)) if __name__ == "__main__": n = int(raw_input().strip()) a = list(map(long, raw_input().strip().split(' '))) X = rwh_primes2(10**7+1) #print(X) result = longestSequence(a) #result = prime_factors(98765) print(result)