#include <bits/stdc++.h>
int ans, i, j, m, n;
int a[1000];
int gcd(int a, int b) {
  int t;
  if (b > a) {
    t = a;
    a = b;
    b = t;
  }
  if (b == 0) {
    return (a);
  }
  if (a >= b) {
    return (gcd(b, a % b));
  }
}
int main() {
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  m = a[n - 1];
  for (i = n - 2; i >= 0; i--) {
    m = gcd(m, a[i]);
  }
  ans = n * m;
  printf("%d", ans);
}
