#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int n, a[N], sum; bool cmp(int x, int y) { return x > y; } signed 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, cmp); for (int i = 1; i <= n; i++) { for (int j = 1; j <= i - 1; j++) a[i] = (int)sqrt(a[i]); sum += a[i]; } cout << sum; return 0; }