#include<bits/stdc++.h>
using namespace std;

#define int long long
#define all(x) (x).begin(),(x).end
#define rall(x) (x).rbegin(),(x).rend

const int MOD=(int)1e9+7;

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    //freopen("teamwork.in","r",stdin);
    //freopen("teamwork.out","w",stdout);
    int n;
    cin>>n;
    int a[n+1],pref[n+1]={};
    for(int i=1;i<=n;i++){
        cin>>a[i];
        pref[i]=a[i]+pref[i-1];
    }
    int sum1=0,sum2=0;
    for(int i=1;i<=n;i++) sum1+=(a[i]*a[i]);
    sum1*=n-1;
    for(int i=1;i<=n;i++){
        sum2+=a[i]*(pref[n]-pref[i]);
    }
    sum2*=(-2);
    cout<<sum1+sum2;
}

#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;
}