#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int s = 0, c = 0;
  int a[120];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    c += a[i];
  }
  while (1) {
    s = 0;
    sort(a, a + n);
    if (a[n - 1] == a[0]) {
      break;
    }
    for (int j = n - 1; j > 0; j--) {
      if (a[j] != a[j - 1]) {
        a[j] = a[j] - a[j - 1];
      } else {
        continue;
      }
    }
    for (int i = 0; i < n; i++) {
      s += a[i];
    }
    c = s;
  }
  cout << c << endl;
  return 0;
}
