#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  if (a % b == 0)
    return b;
  else
    return gcd(b, a % b);
}
int main(int argc, char const *argv[]) {
  int n;
  cin >> n;
  int nums[n];
  int before;
  cin >> before;
  int input;
  for (int i = 1; i < n; ++i) {
    cin >> input;
    if (input < before) swap(input, before);
    before = gcd(input, before);
  }
  cout << before * n << endl;
  return 0;
}
