#!/bin/python3 import sys def find_largest_prime(n): if n == 0: return 0 max_factor = 1 while n % 2 == 0: max_factor = 2 n //= 2 if n == 1: return max_factor while n % 3 == 0: max_factor = 3 n //= 3 if n == 1: return max_factor factor6 = 6 max_factor = 5 while n >= 5: while n % (factor6-1) == 0: max_factor = factor6-1 n //= max_factor if n == 1: return max_factor while n % (factor6+1) == 0: max_factor = factor6+1 n //= max_factor factor6 += 6 return max_factor def longestSequence(a): total_moves = 0 lpf_dict = {} for n in a: moves = 1 prev_lpf = 1 lpf = lpf_dict.setdefault(n, find_largest_prime(n)) divident = n while lpf > 1: quotient = divident//lpf prev_lpf = prev_lpf*lpf moves += prev_lpf lpf = lpf_dict.setdefault(quotient, find_largest_prime(quotient)) divident = quotient total_moves += moves return total_moves if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)