#include <bits/stdc++.h>
using namespace std;
int arr[105];
int main() {
  int a, b, c, i, j, k, n, m;
  while (scanf("%d", &n) != EOF) {
    for (i = 0; i < n; i++) scanf("%d", &arr[i]);
    while (1) {
      sort(arr, arr + n);
      a = arr[0];
      c = 0;
      for (j = 1; j < n; j++) {
        if (arr[j] > a) {
          arr[j] -= a;
          c++;
        }
      }
      if (!c) break;
    }
    printf("%d\n", arr[0] * n);
  }
  return 0;
}
