Fox Ciel is playing a game with numbers now. 

Ciel has *n* positive integers: *x*<sub class="lower-index">1</sub>, *x*<sub class="lower-index">2</sub>, ..., *x*<sub class="lower-index">*n*</sub>. She can do the following operation as many times as needed: select two different indexes *i* and *j* such that *x*<sub class="lower-index">*i*</sub> &gt; *x*<sub class="lower-index">*j*</sub> hold, and then apply assignment *x*<sub class="lower-index">*i*</sub> = *x*<sub class="lower-index">*i*</sub> - *x*<sub class="lower-index">*j*</sub>. The goal is to make the sum of all numbers as small as possible.

Please help Ciel to find this minimal sum.
The first line contains an integer *n* (2 ≤ *n* ≤ 100). Then the second line contains *n* integers: *x*<sub class="lower-index">1</sub>, *x*<sub class="lower-index">2</sub>, ..., *x*<sub class="lower-index">*n*</sub> (1 ≤ *x*<sub class="lower-index">*i*</sub> ≤ 100).
n = int(input())
k = list(map(int, input().split()))
k = sorted(k)
r=[]
for i in k:
    if i not in r:
        r.append(i)
r=sorted(r)
if len(r)==1:print(len(k)*k[0])
elif len(r)==2:
 while r[0]!=r[1]:
    r.append(r[1]-r[0])
    r=sorted(r)
    r.remove(r[-1])
 print(len(k)*r[0])
elif len(k)==3:
    s=[]
    for h in range(1,len(k)):

        if k[h] % k[0] != 0:
            s.append(len(k))
        else:
            t = []
            for w in range(1, len(r)):
                t.append(r[w] - r[w - 1])
            s.append(min(t) * len(k))
    print(min(s))
elif len(r)>3:
     t=[]
     for w in range(1,len(r)):
        t.append(r[w]-r[w-1])
     print(min(t)*len(k))









