#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  int min = 101;
  int arr[n];
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    arr[i] < min ? min = arr[i] : 1;
  }
  int count = -1;
  while (count != 0) {
    count = 0;
    for (int i = 0; i < n; i++) {
      while (arr[i] > min) {
        arr[i] = arr[i] - min;
        count++;
      }
      if (arr[i] < min) {
        min = arr[i];
      }
    }
  }
  count = 0;
  for (int i = 0; i < n; i++) {
    count = count + arr[i];
  }
  cout << count;
}
