#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  for (int i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int i = 0;
  int x;
  int y;
  x = a[0];
  for (int i = 1; i < n; i++) {
    y = a[i];
    while (x != y) {
      if (y > x)
        y = y - x;
      else if (x > y)
        x = x - y;
    }
  }
  cout << x * n;
  return 0;
}
