#include <bits/stdc++.h>
using namespace std;
int a[205];
int main(void) {
  cin.sync_with_stdio(false);
  int i, n;
  cin >> n;
  for (i = 0; i < n; i++) cin >> a[i];
  sort(a, a + n);
  int f = 1;
  while (f) {
    f = 0;
    for (i = n - 1; i > 0; i--) {
      if (a[i] > a[i - 1]) {
        a[i] -= a[i - 1];
        f = 1;
        sort(a, a + n);
      }
    }
  }
  int ans = 0;
  for (i = 0; i < n; i++) ans += a[i];
  cout << ans;
  return 0;
}
