#!/bin/python3 import sys def func(n): if n == 1: return 1 div_list = [] i = 2 while n%2 == 0: n //= 2 div_list.append(2) i = 3 while i*i <= n: if n%i == 0: while n%i == 0: n //= i div_list.append(i) i += 2 if n != 1: div_list.append(n) n = 1 if len(div_list) == 1: return 1 + div_list[0] res = 0 factor = 1 div_list.reverse() for idx in range(len(div_list)): res += factor factor *= div_list[idx] return res + factor def longestSequence(a): # Return the length of the longest possible sequence of moves. total = 0 for el in a: total += func(el) #for i in range(1, 12): # print(i, func(i)) return total if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)