#!/bin/python3 import sys import math def longestSequence(a): # Return the length of the longest possible sequence of moves. moves = 0 for choc in a: pieces = 1 size = choc divisors = [] while size%2 == 0: divisors.append(2) size = int(size/2) start = 3 while size > 1: sqch = int(math.sqrt(size)) ended = True for i in range(start,sqch+1,2): if size%i == 0: divisors.append(i) size = int(size/i) start = i ended = False break if ended: divisors.append(size) size = 1 while divisors: moves += pieces pieces *= divisors.pop() moves += pieces return moves if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)