/*Rabbi Zidni Ilma*/

#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define scl(n) scanf("%lld",&n)
#define scll(n,m) scanf("%lld %lld",&n,&m)
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
#define mod 1000000007
#define read freopen("input.txt","r",stdin)
#define write freopen("output.txt","w",stdout)

ll arr[200000],cumsum[200000];

int main()
{
    ll n,curr=0,i,ans=0;
    scl(n);
	
    for(i=0;i<n;i++)
    scl(arr[i]);
    
    sort(arr,arr+n);
    
    for(i=0;i<n;i++)
    {
    	cumsum[i]=curr+arr[i];
    	curr=cumsum[i];
	}
	for(i=0;i<n;i++)
    {
    	ans+=cumsum[n-1]-cumsum[i]-arr[i]*(n-1-i);
	}
    printf("%lld\n",ans);
}

#include<iostream>
using namespace std;


int main(){

	int n;
	cin>>n;

	

	int ans = 0;
	for(int i = 0; i < n; i++){
		int d;
		cin>>d;

		if(d > 10){
			ans += d - 10;
		}
	}
	cout<<ans;
}