#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a < b)
    return gcd(b, a);
  else if (a == b)
    return a;
  else if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
int main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
  }
  int x = gcd(arr[0], arr[1]);
  for (int i = 2; i < n; i++) x = gcd(x, arr[i]);
  cout << (x * n);
}
