#include <bits/stdc++.h>
using namespace std;
int n;
int arr[105];
void print() {
  int i;
  for (i = 0; i < n; i++) cout << arr[i] << " ";
  cout << endl;
}
int main() {
  cin >> n;
  int i;
  for (i = 0; i < n; i++) cin >> arr[i];
  sort(arr, arr + n);
  while (arr[0] != arr[n - 1]) {
    for (i = 0; i < n; i++) {
      if (arr[i] > arr[i - 1]) {
        arr[i] = arr[i] - arr[i - 1];
      }
    }
    sort(arr, arr + n);
  }
  cout << arr[0] * n << endl;
}
