#include <bits/stdc++.h>
using namespace std;
long long a[100005], n, sum, pos;
void solve()
{
	for (int i = pos + 1; i <= n; ++i)
	{
		a[i] = int(sqrt(a[i]));
	}
}
bool cmp(long long x, long long y)
{
	return x > y; 
}
int main()
{
	cin >> n;
	for (int i = 1; i <= n; ++i)
	{
		scanf("%d", a + i);
	}
	sort(a + 1, a + n + 1, cmp);
	for (pos = 1; pos <= n; ++pos)
	{
		sum += a[pos];
		solve();
	}
	cout << sum << endl;
	return 0;
}