from functools import reduce N = int(input()) A = list(map(int, input().split())) lg = [0] * (1 << 17) for i in range(1, 1 << 17): lg[i] = lg[i >> 1] + 1 def gcd(x, y): while y != 0: if x < y: x, y = y, x else: k = lg[x] - lg[y] x ^= y << k return x 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)