#include <bits/stdc++.h>   using namespace std;   int main() {     int n, i, m, r = 0, t;     cin >> n;     for (i = 0; i < n; i++) {       cin >> m;       while ((m) && (r)) {         if (m > r)           m %= r;         else           r %= m;       }       r += m;     }     cout << r * n << endl;   }   