class PrimeGenException(Exception): pass def is_prime(this, memo): for p in memo[3:]: if this % p == 0: return False return True def prime_generator(memo): if memo: raise PrimeGenException('cannot begin with a memo') for this in (2,3,5,7): memo.append(this) yield this wheel = [4,2,4,2,4,6,2,6] wix, wlen = 0, len(wheel) while True: this += wheel[wix] if is_prime(this, memo): memo.append(this) yield this wix += 1 wix %= wlen def get_factors(n, pgen, pmemo): res = [] fx, f = 0, 2 while f * f <= n: while n % f == 0: res.append(f) n //= f fx += 1 while fx >= len(pmemo): next(pgen) f = pmemo[fx] if n > 1: res.append(n) return res pmemo = [] pgen = prime_generator(pmemo) for i in range(4): next(pgen) def longestSequence(n): if n in (0,1): return n pieces = result = 1 for f in reversed(get_factors(n, pgen, pmemo)): pieces *= f result += pieces return result if __name__ == "__main__": a = input() result = 0 for a in map(int, input().strip().split(' ')): result += longestSequence(a) print(result)