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