#!/bin/python3 import sys from functools import lru_cache @lru_cache(maxsize=None) def findHighestFactor(a): # returns largest prime factor b=2 while a > 1: if a%b==0: a/=b else: b+=1 return b def longestSequence(a): sum=0 for x in a: sum+=longestSequence_r(x) return int(sum) @lru_cache(maxsize=None) def longestSequence_r(a): # Return the length of the longest possible sequence of moves. if(a==1): return 1 highestFactor = findHighestFactor(a) if(highestFactor==a): return a+1 return 1+highestFactor*longestSequence_r(a/highestFactor) if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)