#!/bin/python3 import sys def isPrime(n): if n < 2: return False for x in range(2, int(n**0.5) + 1): if n % x == 0: return False return True primes = [x for x in range(100) if isPrime(x)] def longestSequence(a): # Return the length of the longest possible sequence of moves. total_sequence = 0 for x in a: #print('process...', x) sequences = [x] if isPrime(x): total_sequence += x+1 #print('total_sequence: ', total_sequence) else: while x > 1: for p in primes: if (x % p) == 0: sequences.append(int(x/p)) x = int(x/p) break #print(sequences) total_sequence += sum(sequences) #print('total_sequence: ', total_sequence) return total_sequence if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)