#include<bits/stdc++.h>
#define int long long
using namespace std;
int n , a[100005] , ans;
bool is1[100005];
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];
	}
	stable_sort(a + 1 , a + n + 1 , greater<int>());
	for(int i = 1 ; i <= n ; i ++){
		ans += a[i];
		for(int j = i + 1 ; j <= n ; j ++){
			if(is1[j]){
				break;
			}
			a[j] = (int)sqrtl(a[j]);
			if(a[j] == 1) is1[j] = 1;
		}
	}
	cout << ans;
	return 0;
}