#!/bin/python import sys def calculate(a): lst=[] b=a i=2 while True: while a%i==0: a=int(a/i) lst.append(i) if a<=1: break if a<=1: break i=i+1 c=1 m=1 for i in lst[::-1]: c=c+m*i m=m*i return c def longestSequence(a): # Return the length of the longest possible sequence of moves. tot=0 for i in a: c=calculate(i) tot=tot+c return tot if __name__ == "__main__": n = int(raw_input().strip()) a = map(long, raw_input().strip().split(' ')) result = longestSequence(a) print result