#include <bits/stdc++.h>
using namespace std;
void solve(int a[], const int &n);
bool IsFinish(int a[], const int &n);
int main() {
  int n;
  cin >> n;
  int *a = new int[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  solve(a, n);
  int sum = 0;
  for (int i = 0; i < n; i++) sum += a[i];
  cout << sum;
}
void solve(int a[], const int &n) {
  while (IsFinish(a, n) == false) {
    for (int i = 0; i < n; i++) {
      for (int j = 0; j < n; j++) {
        while (a[j] < a[i]) a[i] -= a[j];
      }
    }
  }
}
bool IsFinish(int a[], const int &n) {
  for (int i = 1; i < n; i++) {
    if (a[i] != a[i - 1]) return false;
  }
  return true;
}
