#include <bits/stdc++.h>
using namespace std;
int a[100005];
int main()
{
	int n;
	long long s = 0;
	cin >> n;
	for (int i = 1; i <= n; i ++)
	{
		cin >> a[i];
	}
	sort(a + 1, a + n + 1);
	reverse(a + 1, a + n + 1);
	int t = 0;
	for (int i = 1; i <= n; i ++)
	{
		for (int j = 1; j <= t; j ++)
		{
			if (a[i] == 1) break;
			int y = sqrt(a[i]);
			a[i] = y;
		}
		t ++;
		s += a[i];
	}
	cout << s << endl;
	return 0;
}