#include<bits/stdc++.h>
#define maxn 300010
using namespace std;
typedef long long LL;
int read()
{
	int s=0,w=1;
	char ch=getchar();
	while(ch<'0'||ch>'9') {if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9') s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
	return s*w;
}
int n;
long long A[maxn],s,ans;
signed main()
{
	n=read();
	for(int i=1;i<=n;i++) A[i]=read(),s+=A[i];
	for(int i=1;i<=n;i++)
	{
		ans+=A[i]*A[i]*(n-1)-(s-A[i])*A[i];
	}
	cout<<ans<<'\n';
	return 0;
}
#include<cstdio>
#include<set>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<cstdlib>
#include<time.h>
#include<string>
#include<stack>
#include<cmath>
#include<iostream>
#include<cstring>
#include<complex>
#include<tr1/unordered_set>
#include<tr1/unordered_map>
#include <chrono>
#include <iomanip>
using namespace std;
using namespace tr1;
#define FOR(i,j,k) for(int i=j;i<k;i++)
#define FORD(i,j,k) for(int i=j;i>=k;i--)
#define ll long long
//Make sure no overflow problems
#define pii  pair<int, int>
#define vi vector<int >
#define pb push_back
#define mp make_pair
#define fffirst
#define ss second
#define VAR(i,n) __typeof(n) i = (n)
#define FOREACH(i,c) for(VAR(i,(c).begin());i!=(c).end();i++)
#define FORDEACH(i,c) for( VAR(i,(c).rbegin()),i!=(c).rend();i++)
#define REP(i,n) FOR(i,0,n)
#define ld long double
const int INF = 1000000009;
const long long INFLL = (ll)INF * (ll)INF;
const ld EPS = 10e-9;
///////////////////////////////////////////////////////////////
#define curr_time std::chrono::high_resolution_clock::now()
int main(){
  ios_base::sync_with_stdio(0);
  cin.tie(0),cout.tie(0);
  int n;
  cin>>n;
  map<int,ll> freq;
  int val;
  for(int i=0;i<n;i++){
	  cin>>val;
	  freq[val]++;
  }
  ll ans=0;
  for(int i=-200;i<=200;i++){
	  for(int j=i+1;j<=200;j++){
		  ans+=freq[i]*freq[j]*abs(i-j)*abs(i-j);
	  }
  }
  cout<<ans;
  return 0;
}