#!/bin/python import sys import math def getDivisor(n): if n % 2 == 0: return 2 if n % 3 == 0: return 3 sqrt_n = int(math.sqrt(n)) for d in xrange(5, sqrt_n+1, 2): if n % d == 0: return d return n def longestSequence(a): # Return the length of the longest possible sequence of moves. count = 0 for chocolate in a: count += chocolate while chocolate != 1: smallestDivisor = getDivisor(chocolate) chocolate = chocolate / smallestDivisor count += chocolate return count if __name__ == "__main__": n = int(raw_input().strip()) a = map(long, raw_input().strip().split(' ')) result = longestSequence(a) print result