#include<bits/stdc++.h> #define int long long using namespace std; int cnt; bool cmp(int a,int b){ return a>b; } signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n; cin>>n; int a[n]; for(int i=0;i<n;i++){ cin>>a[i]; } sort(a,a+n,cmp); for(int i=0;i<n;i++){ int t=a[i]; if(i){ for(int j=0;j<i;j++){ t = (int)sqrt(t); } } cnt+=t; } cout<<cnt; return 0; }