#include<bits/stdc++.h>
#define int long long
using namespace std;

const int N = 1e5;
int n, ans;
int a[N + 5];
stack<int> q;
bool f = 0;

signed main(){
	cin >> n;
	for(int i = 1;i <= n;i++){
		cin >> a[i];
	}
	sort(a + 1, a + n + 1);
	for(int i = 1;i <= n;i++){
		q.push(a[i]);
	}
	for(int i = 1;i <= n;i++){
		int t = q.top();
		q.pop();
		if(i == 1){
			ans += t;
			f = 1;
		}
		else{
			for(int j = 1;j < i;j++){
				t = sqrt(t);
			}
			ans += t;
		}
	}
	cout << ans << "\n";
	return 0;
}