#include <bits/stdc++.h>
using namespace std;
#define int long long
int a[100005];
bool cmp(int x, int y) {
	return x > y;
}
signed main() {
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int n;
	long long sum = 0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	sort(a + 1, a + 1 + n, cmp);
	for (int i = 1; i <= n; i++) {
		int x = a[i];
		for (int j = 1; j < i; j++) {
			int y = (int)sqrt(x);
			x = y;
		}
		sum += x;
	}
	cout << sum;
	return 0;
}