/*#include<bits/stdc++.h> using namespace std; const int N = 32010; long long n , m , k , cnt1 , cnt2; struct node { int x , y; }a[N]; int main() { cin>> n >> m >> k; for( int i = 1 ; i <= n ; i ++ ) { cnt1 ++; a[cnt1].x = i; a[cnt1].y = 1; for( int j = 2 ; j <= m ; j ++ ) { cnt1 ++; a[cnt1].x = i; a[cnt1].y = j; } } cnt2 ++; a[1].x = 1; a[1].y = 1 + m; for( int i = 2 ; i <= m ; i ++ ) { cnt2 ++; a[cnt2].x = a[cnt2-1].x + 1; a[cnt2].y = a[cnt2-1].y + 1; } //int t = m; for( int i = 2 ; i <= n ; i ++ ) { cnt2 ++; //if( t == m ) //{ a[cnt2].x = a[cnt2-1].x - 1; a[cnt2].y = a[cnt2-1].y - m; //t = 1; //continue; //} //t ++; //a[cnt2].x = a[cnt2-1].x + 1; //a[cnt2].y = a[cnt2-1].y + 1; for( int j = 2 ; j <= m ; j ++ ) { cnt2 ++; a[cnt2].x = a[cnt2-1].x + 1 , a[cnt2].y = a[cnt2-1].y + 1; } } cout<< a[k].x << " " << a[k].y << endl; return 0; } */ #include<bits/stdc++.h> #define LL long long using namespace std; const int N = 1e6 + 10; LL n , x[N] , ans; bool cmp( LL a , LL b ) { return a > b; } int main() { cin>> n; for( LL i = 1 ; i <= n ; i ++ ) { cin>> x[i]; } sort( x + 1 , x + 1 + n , cmp ); for( LL i = 1 ; i <= n ; i ++ ) { ans += x[i]; for( LL j = i + 1 ; j <= n ; j ++ ) { x[j] = (int)sqrt(x[j]); } } cout<< ans << endl; return 0; }