from functools import reduce N = int(input()) A = list(map(int, input().split())) def gcd(x, y): while y != 0: if x < y: x, y = y, x else: k = len(str(x)) - len(str(y)) x -= y << k return y g = reduce(gcd, A) f = [0] * 100001 for x in A: f[x] += x souwa = sum(A) ans = 10**100 for i in range(1, 100001): s = sum(f[j] for j in range(i, 100001, i)) if gcd(i, g) == g: ans = min(ans, souwa - s + s // i) print(ans)