#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
  int Remainder;
  while (b != 0) {
    Remainder = a % b;
    a = b;
    b = Remainder;
  }
  return a;
}
int main() {
  int t;
  cin >> t;
  int ary[t];
  for (int i = 0; i < t; i++) {
    cin >> ary[i];
  }
  int g = ary[0];
  for (int i = 1; i < t; i++) {
    g = gcd(g, ary[i]);
  }
  cout << g * t << endl;
}
