#include <bits/stdc++.h>
void isort(int a[], int n) {
  int i, j, t;
  for (i = 0; i < n; i++) {
    for (j = i; j < n; j++) {
      if (a[i] < a[j]) {
        t = a[i];
        a[i] = a[j];
        a[j] = t;
      }
    }
  }
}
int main() {
  int n, a[100], i, sum;
  while (scanf("%d", &n) == 1) {
    for (i = 0; i < n; i++) {
      scanf("%d", &a[i]);
    }
    isort(a, n);
    while (a[0] != a[n - 1]) {
      i = 1;
      while (a[0] == a[i]) {
        i++;
      }
      a[0] = a[0] - a[i];
      isort(a, n);
    }
    sum = 0;
    for (i = 0; i < n; i++) {
      sum += a[i];
    }
    printf("%d\n", sum);
  }
  return 0;
}
