#include<bits/stdc++.h> using namespace std; long long n, a[1001000], ans, fl; long long sq(long long x, long long sqn) { long long y = x, ans = x; while(sqn--) { ans = (int)sqrt(y); y = ans; } return ans; } int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> n; for(int i = 1; i <= n; i++) cin >> a[i]; sort(a + 1, a + n + 1); fl = 0; for(int i = n; i >= 1; i--) { ans += sq(a[i], fl); fl++; } cout << ans << "\n"; return 0; }