#!/bin/python import sys, math def longestSequence(a): # Return the length of the longest possible sequence of moves. result = 0 for i in a: if i!=1: res = i l = int(math.ceil(math.sqrt(i))) while not i%2: i=i/2 res+=i if(i!=1): for j in xrange(3,l+1,2): while not i%j: i=i/j res+=i if(i==1): res-=1 break res = res+1 else: res = 1 result+= res return result if __name__ == "__main__": n = int(raw_input().strip()) a = map(long, raw_input().strip().split(' ')) result = longestSequence(a) print result