#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int main() {
  int n, b;
  while (scanf("%d", &n) != EOF) {
    b = 0;
    int ans;
    scanf("%d", &ans);
    for (int i = 1; i < n; i++) {
      scanf("%d", &b);
      ans = gcd(ans, b);
    }
    printf("%d\n", ans * n);
  }
  return 0;
}
