#include <bits/stdc++.h>
using namespace std;
long long a[100001];
bool b[100001];
int n;
int f()
{
	bool l = false;
	for(int i = 1; i <= n; i ++)
	{
		if(b[i] == false)
		{
			l = true;
		}
	}
	if(l == false)
	{
		return 0;
	}
	int maxs = -1;
	int fh = -1;
	for(int i = 1; i <= n; i ++)
	{
		if(a[i] > maxs && !b[i])
		{
			maxs = a[i];
			fh = i;
		}
	}
	b[fh] = true;
	for(int i = 1; i <= n; i ++)
	{
		if(!b[i])
		{
			a[i] = sqrt(a[i]);
		}
	}
	return maxs + f();
}
int main()
{
	cin >> n;
	for(int i = 1; i <= n; i ++)
	{
		cin >> a[i];
	}
	int maxy = f();
	cout << maxy;
	return 0;
}