#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  sort(v.begin(), v.end());
  while (v[0] != v[v.size() - 1]) {
    v[v.size() - 1] -= v[0];
    sort(v.begin(), v.end());
  }
  cout << v[0] * v.size();
}
