#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e5 + 7;
int n, idx = 1, ans, a[N];
bool cmp(int x, int y){
	return x > y;
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0); 
	cin >> n;
	for(int i = 1; i <= n; i++){
		cin >> a[i];
	}
	sort(a + 1, a + n + 1, cmp);
	for(int i = 1; i <= n; i++){
		ans += a[i];
		idx++;
		for(int j = idx; j <= n; j++){
			a[j] = (int)sqrt(a[j]);
		}
	}
	cout << ans << '\n';
	return 0;
}