#include <bits/stdc++.h>
using namespace std;
int N, mn, ii, S[105];
int main() {
  scanf("%d", &N);
  for (int i = 0; i < N; i++) scanf("%d", &S[i]);
  while (1) {
    sort(S, S + N);
    mn = 1000000000, ii = -1;
    for (int i = 1; i < N; i++) {
      if (S[i] != S[i - 1] && ((S[i] - S[i - 1]) < mn)) {
        mn = S[i] - S[i - 1];
        ii = i;
      }
    }
    if (ii > -1)
      S[ii] = mn;
    else
      break;
  }
  printf("%d\n", S[0] * N);
  return 0;
}
