#include <bits/stdc++.h>
static int gcd(int a, int b) {
  while (b > 0) {
    int r = a % b;
    a = b;
    b = r;
  }
  return a;
}
int main(int argc, const char* argv[]) {
  int n;
  std::cin >> n;
  int r;
  std::cin >> r;
  for (int i = 1; i < n; i++) {
    int t;
    std::cin >> t;
    r = gcd(r, t);
  }
  std::cout << n * r << std::endl;
  return 0;
}
