#!/bin/python3 import sys import math def factorize_number(number): res=[] count=0 while number%2==0: count+=1 number//=2 if count>0: res.append((2,count)) for i in range(3,int(math.sqrt(number)+2),2): if i > number: break count=0 while number%i==0: count+=1 number//=i if count>0: res.append((i,count)) if number>1: res.append((number,1)) return res def longestSequence(n): res=factorize_number(n) res=res[::-1] result=0 sofar=1 for i in range(len(res)): for j in range(res[i][1]): result+=sofar sofar*=res[i][0] result+=n return result if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result=0 for i in range(n): result += longestSequence(a[i]) print(result)