#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAXN=1e5+10;
ll a[MAXN];
bool cmp(ll x,ll y){
	return x>y;
}
int main(){
	ll n,ans=0,num=0;
	scanf("%lld",&n);
	for(ll i=1;i<=n;i++){
		scanf("%lld",&a[i]);
	}
	sort(a+1,a+n+1,cmp);
	for(ll i=1;i<=n;i++){
		ans=ans+a[i];
		num=num+2;
		ll temp=1;
		while(pow(temp,num)<=a[i+1]) temp++;
		temp--;
		a[i+1]=temp;
	}
	printf("%lld",ans);
	return 0;
}