//luogu :xmy201315 welcome to chat with me
#include <bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define per(i,l,r) for(int i=l;i>=r;i--)
int n;
int a[100005],x=0;
long long ans=0;
int main(){
	cin>>n;
	rep(i,1,n)scanf("%d",&a[i]);
	sort(a+1,a+n+1);
	per(i,n,1){
		int y=x;
		rep(_,1,y)a[i]=(int)sqrt(a[i]);
		ans+=1LL*a[i],x++;
	}
	cout<<ans;
}
//^_^,EASY