#include<bits/stdc++.h> using namespace std; int n,x[100007]; long long ans=0; int main() { cin>> n; for(int i=1;i<=n;i++) cin>> x[i]; for(int i=1;i<=n;i++){ sort(x+1,x+n+1,greater<int>()); ans+=x[i]; for(int j=i;j<=n;j++){ x[j]=sqrt(x[j]); } } cout<< ans; }