#include <bits/stdc++.h>
using namespace std;
struct qqq {
  int l, in;
};
qqq qq[100009] = {};
bool cmp(qqq a, qqq b) { return a.l > b.l; }
int main() {
  int n;
  cin >> n;
  int a[200000] = {};
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  sort(a, a + n);
  while (a[0] != a[n - 1]) {
    a[n - 1] -= a[0];
    sort(a, a + n);
  }
  int sum = 0;
  for (int i = 0; i < n; i++) sum += a[i];
  cout << sum;
  return 0;
}
