#include <bits/stdc++.h>
using namespace std;
template <typename T>
void p(T val) {}
void solve();
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int t = 1;
  while (t--) {
    solve();
    cout << "\n";
  }
  cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;
  return 0;
}
void solve() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  bool changed = true;
  while (changed) {
    sort(v.begin(), v.end());
    int x = v[0];
    changed = false;
    for (int i = 1; i < n; ++i) {
      while (v[i] > x) {
        v[i] -= x;
        changed = true;
      }
    }
  }
  cout << accumulate(v.begin(), v.end(), 0);
}
