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