#include <bits/stdc++.h>
using namespace std;
int main() {
  int a[105];
  int i, j, k, l, m, n, t, minim;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  minim = a[1];
  bool check = true;
  while (check) {
    check = false;
    for (i = 1; i <= n; i++) {
      while (a[i] > minim) {
        a[i] = a[i] - minim;
      }
      if (a[i] < minim) {
        check = true;
        minim = a[i];
      }
    }
  }
  int ans = 0;
  for (i = 1; i <= n; i++) ans += a[i];
  cout << ans << endl;
  return 0;
}
