#include <bits/stdc++.h>
using namespace std;
int main() {
  int x, y, maxi = INT_MIN, mini = INT_MAX;
  cin >> x;
  set<int> a;
  vector<int> b;
  for (int i = 0; i < x; i++) {
    cin >> y;
    a.insert(y);
    if (y > maxi) maxi = y;
    if (y < mini) mini = y;
  }
  for (std::set<int>::iterator it = a.begin(); it != a.end(); ++it)
    b.push_back(*it);
  int siz = b.size();
  bool bb = false;
  while (!bb) {
    for (int k = 0; k < siz; k++) {
      for (int l = 0; l < siz; l++) {
        if (k != l && b[k] > b[l]) {
          b[k] -= b[l];
          break;
        }
      }
    }
    bb = true;
    for (int o = 0; o < siz - 1; o++)
      if (b[o + 1] != b[o]) bb = false;
  }
  cout << b[0] * x << endl;
  return 0;
}
