#include <bits/stdc++.h>
using namespace std;
void solve() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> b;
  int ent;
  for (int i = 0; i < n; i++) {
    cin >> ent;
    b.push_back(ent);
  }
  int num;
  while (1) {
    bool cond = true;
    sort(b.begin(), b.end());
    num = b[0];
    for (int i = 0; i < b.size(); i++) {
      if (b[i] != num) {
        b[i] = b[i] - num;
        cond = false;
      }
    }
    if (cond) break;
  }
  sort(b.begin(), b.end());
  cout << b[0] * n << endl;
}
int main() { solve(); }
