#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,a[100005],pos,sum;

bool check()
{
	for(int i=1;i<=pos;i++)
		if(a[pos]!=0)
			return true;
	return false;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	cin>>n;
	pos=n;
	for(int i=1;i<=n;i++)
		cin>>a[i];
	while(check())
	{
		sort(a+1,a+pos+1);
		sum+=a[pos];
		for(int i=1;i<=pos;i++)
			a[i]=ll(sqrt(a[i]));
		pos--;
	}
	cout<<sum;
	return 0;
}