import numpy
N = int(input())
L = numpy.array(list(map(int, input().split())))

m = numpy.inf

while True:
    if numpy.min(L) == m:
        break

    m = numpy.min(L)
    mi = numpy.argmin(L)

    L = L % m
    L[mi] = m
    L = L[L != 0]

print(numpy.sum(L)) import numpy numpy N = int(input()) N int(input()) int input() input L = numpy.array(list(map(int, input().split()))) L numpy.array(list(map(int, input().split()))) numpy.array numpy array list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split m = numpy.inf m numpy.inf numpy inf while True:
    if numpy.min(L) == m:
        break

    m = numpy.min(L)
    mi = numpy.argmin(L)

    L = L % m
    L[mi] = m
    L = L[L != 0] True if numpy.min(L) == m:
        break

     numpy.min(L) == m numpy.min(L) numpy.min numpy min L m break m = numpy.min(L) m numpy.min(L) numpy.min numpy min L mi = numpy.argmin(L) mi numpy.argmin(L) numpy.argmin numpy argmin L L = L % m L L % m L m L[mi] = m L[mi] L mi m L = L[L != 0] L L[L != 0] L L != 0 L 0 print(numpy.sum(L)) print numpy.sum(L) numpy.sum numpy sum L L = L[L != 0] L[L != 0] L m = numpy.inf numpy.inf m L = L % m L % m L N = int(input()) int(input()) N m = numpy.min(L) numpy.min(L) m mi = numpy.argmin(L) numpy.argmin(L) mi L = numpy.array(list(map(int, input().split()))) numpy.array(list(map(int, input().split()))) L
import numpy
N = int(input())
L = numpy.array(list(map(int, input().split())))

m = numpy.inf

while True:
    if numpy.min(L) == m:
        break

    m = numpy.min(L)
    mi = numpy.argmin(L)

    L = L % m
    L[mi] = m
    L = L[L != 0]

print(numpy.sum(L))