#!/bin/python import sys def longestSequence(a): #a=list(a) x=0 for i in a: x=x+i i2=i #i1=2 while i2!=1: i1=2 while i1<=i2: if i2%i1==0: i2=i2/i1 x=x+i2 break i1=i1+1 return x # Return the length of the longest possible sequence of moves. if __name__ == "__main__": n = int(raw_input().strip()) a = map(long, raw_input().strip().split(' ')) result = longestSequence(a) print result