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