import math leng={1:1,2:3,3:4,4:7,5:6,6:10,7:8} def get_c(item): if item%2==0: if item/2 in leng: leng[item]=leng[item/2]+item return leng[item] else: leng[item]=get_c(item/2)+item return leng[item] else: for i in range(2,int(math.sqrt(item))+1): #print item,i if item%i==0: if item/i in leng: leng[item]=leng[item/i]+item return leng[item] else: leng[item]=get_c(item/i)+item return leng[item] #print "here" leng[item]=item+1 return leng[item] n=input() a=map(int,raw_input().split(" ")) cost=0 for item in a: if item in leng: cost+=leng[item] else: cost+=get_c(item) print cost