#include <bits/stdc++.h>
using namespace std;
long long int data[1000];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> data[i];
  while (true) {
    sort(data, data + n);
    if (data[n - 1] > data[0]) {
      data[n - 1] -= data[0];
    } else if (data[n - 1] == data[0]) {
      break;
    }
  }
  int out = 0;
  for (int i = 0; i < n; i++) out += data[i];
  cout << out << endl;
  return 0;
}
