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