#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum = 0, min = INT_MAX;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v.at(i);
  }
  while (min != v.at(0)) {
    min = INT_MAX;
    sort(v.begin(), v.end());
    for (int i = n - 1; i > 0; i--) {
      {
        if (v.at(i) > v.at(i - 1)) {
          v.at(i) = v.at(i) - v.at(i - 1);
        }
        if (v.at(i) < min) {
          min = v.at(i);
        }
      }
    }
  }
  for (int i = 0; i < n; i++) {
    sum = sum + min;
  }
  cout << sum;
}
