#!/bin/python3 import sys def findLargestDivisor(n): j=n//2 while j>=1: if n%j==0: return j j-=1 def longestSequence(a): # Return the length of the longest possible sequence of moves. s=0 for i in a: if i==1: s+=1 else:# i%2==1: s+=i d=i while(d>1): d=findLargestDivisor(d) s+=d '''elif i>0: i1=i while i1>1: if i1%2==1: s+=i1 break else: s+=i1 i1=i1//2 s+=1 ''' return s if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)