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