#include <bits/stdc++.h>
const long long MOD = 1e9 + 7;
const int EPS = 1e-6;
const int MAXX = 1e5 + 5;
const double PI = 3.141592653;
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  int n;
  cin >> n;
  vector<int> vec(n);
  for (int i = 0; i < n; ++i) cin >> vec[i];
  while (true) {
    sort(vec.begin(), vec.end());
    if (vec[0] == vec[n - 1]) break;
    for (int i = 1; i < n; ++i) {
      if (vec[i] > vec[i - 1]) vec[i] = vec[i] - vec[i - 1];
    }
  }
  cout << n * vec[0] << endl;
  return 0;
}
