#!/bin/python3 import sys def factor(num): n = num i = 2 primeFactors = [] counts = [] result = [] while n >= i ** 2: if n % i == 0: primeFactors.append(i) counts.append(1) n = n // i while n % i == 0: counts[len(counts) - 1] += 1 n = n // i if i == 2: i += 1 else: i += 2 if n > 1: primeFactors.append(n) counts.append(1) for i in range(len(primeFactors)): for j in range(counts[i]): result.append(primeFactors[i]) return result def longestSequence(a): # Return the length of the longest possible sequence of moves. result = 0 for i in a: factors = factor(i) temp = i result += temp for j in factors: temp = temp // j result += temp return result if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)