#!/bin/python3 import sys def largest_prime_factor(n): i = 2 while i * i <= n: if n % i: i += 1 else: n //= i return n def longestSequence(a): t = 0 for i in a: if i%2==0: t = t+i+1 p = largest_prime_factor(i) j = i / p while (j >=2): t = t + p j = i//p j = j//2 p = 2*p elif i==1: t=t+1 else: t = t + i+1 return(t) # Return the length of the longest possible sequence of moves. if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)