#!/bin/python3 import sys primes = [2,3,5,7,11,13,17,19,23,29,31] for i in range(2, 1000): for p in primes: if i % p == 0: break else: primes.append(i) for i in range(1000, 1000000): for p in primes: if i % p == 0: break elif p > 1000: primes.append(i) break else: primes.append(i) def sub(num): for p in primes: if num % p == 0: return num + sub(num // p) if num == 1: return 1 else: return num + 1 def longestSequence(a): # Return the length of the longest possible sequence of moves. return sum([sub(num) for num in a]) if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)