#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int n;
int x[100005];
int y[100005];
long long cnt;
int main() {
	cin >> n;
	/*for (int i = 0; i < n; i++)
		cin >> x[i];
	sort(x, x + n);
	for (int i = 0; i < n; i++) y[i] = x[i];*/
	for (int i = 0; i < n; i++) cin >> y[i];
	sort(y, y+n);
	for (int i = n - 1; i >= 0; i--) {
		cnt += y[i];
		for (int j = i - 1; j >= 0; j--) y[j] = (int)sqrt(y[j]);
	}
	cout << cnt;
	return 0;
}