#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n;
  cin >> n;
  long long int x[n];
  long long int f[((n) * (n - 1)) / 2];
  long long int k = 0;
  for (long long int i = 0; i < n; i++) cin >> x[i];
  sort(x, x + n, greater<long long int>());
  for (long long int i = 0; i < n; i++) {
    for (long long int j = i + 1; j < n; j++) {
      long long int a = x[i];
      long long int b = x[j];
      while (b != 0) {
        long long int rem = a % b;
        a = b;
        b = rem;
      }
      f[k] = a;
      ++k;
    }
  }
  sort(f, f + ((n) * (n - 1)) / 2);
  long long int t = 0;
  for (long long int i = 0; i < ((n) * (n - 1)) / 2; i++) {
    if (f[i] % f[0] != 0) ++t;
  }
  if (t >= 1)
    cout << 1 * n;
  else
    cout << f[0] * n;
  return 0;
}
