#include <bits/stdc++.h>
using namespace std;
bool can_subtract(vector<int> p) {
  int smallest = -1;
  for (int i = 0; i < p.size(); i++) {
    if (smallest < 0 && smallest < p[i]) {
      smallest = p[i];
    }
    if (smallest > 0 && smallest != p[i]) {
      return true;
    }
  }
  return false;
}
int find_lowest(vector<int> k) {
  while (can_subtract(k)) {
    for (int i = 0; i < k.size(); i++) {
      for (int o = 0; o < k.size(); o++) {
        if (k[o] > k[i]) {
          k[o] = k[o] - k[i];
        } else if (k[i] > k[o]) {
          k[i] = k[i] - k[o];
        }
      }
    }
  }
  int sum = 0;
  for (int i = 0; i < k.size(); i++) {
    sum += k[i];
  }
  return sum;
}
int main(int argc, char** argv) {
  vector<int> num;
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int k;
    cin >> k;
    num.push_back(k);
  }
  cout << find_lowest(num);
}
