#!/bin/python3 import sys from collections import Counter def primes(n): primfac = [] d = 2 while d*d <= n: while (n % d) == 0: primfac.append(d) # supposing you want multiple factors repeated n //= d d += 1 if n > 1: primfac.append(n) return primfac def longestSequence(a): total = 0 # Return the length of the longest possible sequence of moves. for element in a: total += element pf = primes(element) pf = pf[::-1] temp = 1 if element != 1: total += temp for i in range(len(pf) - 1): temp = temp * pf[i] total += temp return total if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)