import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int n = scan.nextInt(); int[]A = new int[n]; int min = Integer.MAX_VALUE; for(int i = 0; i < n; i++) { int t = scan.nextInt(); A[i] = t; if(min > t) { min = t; } } scan.close(); List list = new ArrayList(); for(int i = 2; i <= min; i++) { if(min % i == 0) { list.add(i); } } for(int i = list.size() - 1; i >= 0; i--) { int k = list.get(i); boolean flag = true; for(int j = 0; j < n; j++) { if(A[j] % k != 0) { flag = false; break; } } if(flag) { for(int j = 0; j < n; j++) { A[j] = A[j] / k; } } } int cnt = 0; for(int i = 0; i < n; i++) { cnt += A[i]; } System.out.println(cnt); } }