#include #include int main(){ int size = 0; scanf("%d",&size); int *array = (int *) malloc(sizeof(int) * size); for(int i = 0;i < size;i++){ scanf("%d",&(array[i])); } int res = 0; int result = 0; for(int i = 0;i < size;i++){ for(int j = 0;j < size;j++){ if(array[i] % array[j] == 0 || array[j] % array[i] == 0){ res++; }else { break; } } if(res == size){ result = array[i]; break; }else { res = 0; } } int res_res = 0; for(int i = 0;i < size;i++){ res_res += array[i]; } free(array); printf("%d",res_res - result); }