#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  sort(v.begin(), v.end());
  while (v.back() > v[0]) {
    for (int i = v.size() - 1; i > 0; i--) {
      if (v[i] % v[0])
        v[i] %= v[0];
      else
        v[i] = v[0];
    }
    sort(v.begin(), v.end());
    if (v.back() == v[0]) break;
  }
  cout << accumulate(v.begin(), v.end(), 0);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  int t = 1;
  while (t--) solve();
  return 0;
}
