#include <bits/stdc++.h>
using namespace std;
int a[100005],cnt=1,zd=INT_MIN;
long long sum=0;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n;
	cin>>n;
	for(int i=1; i<=n; i++)
	{
		cin>>a[i];
	}
	sort(a+1,a+n+1);
	reverse(a+1,a+n+1);
	for(int i=1; i<=n; i++)
	{
		if(i==cnt) sum+=a[i];
		for(int j=cnt; j<=n; j++) a[j]=(int)sqrt(a[j]);
		cnt++;
	}
	cout<<sum;
	return 0;
}