#include<bits/stdc++.h> using namespace std; bool cmp(int x,int y) { return x>y; } int main() { int a,s=0; cin>>a; int d[a+2]; bool dl[a+2]; for (int i=1;i<=a;i++) { cin>>d[i]; } sort(d+1,d+a+1,cmp); int cnt=0; for (int i=1;i<=a;i++) { s+=d[i]; for (int j=i+1;j<=a;j++) { d[j]=int(sqrt(d[j])); } } cout<<s; }