#include <iostream>
#include <set>
#include <vector>

using namespace std;

int main(void)
{
    int n;
    cin >> n;
    long a;
    long sum = 0;
    long sum1 = 0;
    for (long i = 0; i < n; i++)
    {
        cin >> a;
        sum += a;
        sum1 += a * a;
    }
    cout << n * sum1 - sum * sum << endl;
    return 0;
}
#include<bits/stdc++.h>
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<queue>
#include<vector>
#include<cstring>
#include<map>
#include<set>
#include<cstdlib>
#include<bitset>
using namespace std;
#define FAST ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
typedef long long ll;
ll a[402]={0};
int main(void)
{
	ll n;
	scanf("%lld",&n);
	for(ll i=0;i<n;i++)
	{
		ll v;
		scanf("%lld",&v);
		a[v+200]++;
	}
	ll ans=0;
	for(ll i=-200;i<=200;i++)
	{
		for(ll j=i+1;j<=200;j++)
		{
			ans+=(i-j)*(i-j)*a[i+200]*a[j+200];
		}
	}
	printf("%lld\n",ans);
}