import math import sys def main(): input = sys.stdin.read().split() n = int(input[0]) a = list(map(int, input[1:n+1])) x = min(a) count_x = a.count(x) sum_total = 0 for num in a: if num == x: continue g = math.gcd(x, num) sum_total += (x * num) // g sum_total += (count_x - 1) * x print(sum_total) if __name__ == "__main__": main()