#include <bits/stdc++.h> #define int long long using namespace std; int a[100005], f[100005]; int work(int x) { int u = a[x], y = x - 1; while (y--) { int t = floor(sqrt(u)); u = t; } return u; } signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; for (int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + 1); reverse(a + 1, a + n + 1); for (int i = 1; i <= n; i++) a[i] = work(i); int ans = 0; for (int i = 1; i <= n; i++) ans += a[i]; cout << ans << "\n"; return 0; }