#!/bin/python3 import sys def longestSequence(a): # Return the length of the longest possible sequence of moves. sum = 0 for entry in a: sum += l_s(entry) return sum def l_s(n): if n == 1: return 1 return max([1 + d*l_s(n//d) for d in divisors_n(n)]) def divisors_n(n): a = [] for i in range(2, n+1): if n%i == 0: a.append(i) return a if __name__ == "__main__": n = int(input().strip()) a = list(map(int, input().strip().split(' '))) result = longestSequence(a) print(result)