#!/bin/python3 import sys import math def longestSequence(a): # Return the length of the longest possible sequence of moves. total_moves = 0 for stick in a: # find prime factors factors = prime_factors(stick) # calculate max moves for this stick # note that factors is sorted in ascending order moves = 1 prod = 1 for f in reversed(factors): prod = prod*int(f) moves += prod total_moves += moves return total_moves def prime_factors(n): # Returns all the prime factors of a positive integer # thanks to https://stackoverflow.com/a/412942 factors = [] d = 2 sqrt_n = int(math.sqrt(n)) while n > 1: while n % d == 0: factors.append(d) n //= d if d == 2: d += 1 else: d += 2 # after 2, all primes are odd if d > sqrt_n: if n > 1: factors.append(n) break return factors if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)