#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
	int n;
	cin>>n;
	int a[n+1];
	int sum=0,tot=0;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		sum+=a[i];
	}
	for(int i=1;i<=n;i++){
		tot+=(n-1)*a[i]*a[i];
		tot-=a[i]*(sum-a[i]);
	}
	cout<<tot;

	return 0;
}

#include <bits/stdc++.h>

#define x first
#define y second

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
typedef pair<double, double> PDD;

const int N = 210;

map<int, int> cnt;

int main()
{
	int n;
	cin >> n;
	for (int i = 1; i <= n; i ++ )
	{
		int x;
		cin >> x;
		cnt[x] ++;
	}

	LL ans = 0;
	for (int i = -200; i <= 200; i ++ )
		for (int j = i + 1; j <= 200; j ++ )
			ans += (LL)cnt[i] * cnt[j] * (j - i) * (j - i);
	cout << ans << endl;

	return 0;
}