#include <bits/stdc++.h>
using namespace std;
int gcd(int x, int y) {
  int r;
  if (x <= 0 || y <= 0) return (0);
  while ((r = x % y) != 0) {
    x = y;
    y = r;
  }
  return (y);
}
int main() {
  int n, t;
  scanf("%d", &n);
  scanf("%d", &t);
  int g = t;
  for (int i = 1; i < n; i++) {
    scanf("%d", &t);
    g = gcd(g, t);
  }
  printf("%d", g * n);
  return 0;
}
