#include <bits/stdc++.h>
using namespace std;
int n, num[1000], sum;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", &num[i]);
  sort(num, num + n);
  while (num[0] != num[n - 1]) {
    for (int i = 1; i < n; i++) {
      if (num[i] % num[0] == 0)
        num[i] = num[0];
      else
        num[i] %= num[0];
    }
    sort(num, num + n);
  }
  printf("%d\n", num[0] * n);
  return 0;
}
