#include <bits/stdc++.h>
using namespace std;
int b;
int a[1000], n;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  while (1 == 1) {
    sort(a, a + n);
    for (int i = 1; i < n; ++i)
      if (a[i] != a[i - 1]) a[i] = a[i] - a[i - 1];
    int met = 0;
    for (int i = 1; i < n; ++i)
      if (a[0] != a[i]) met = 1;
    if (met == 0) break;
  };
  int sum = 0;
  for (int i = 0; i < n; ++i) sum += a[i];
  cout << sum;
}
