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