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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  long long sum = 0;
  long long sum2 = 0;
  for (int i = 0; i < N; i++) {
    cin >> A.at(i);
    sum += (long long)(N - 1) * A.at(i) * A.at(i);
    sum2 += A.at(i);
  }
  for (int i = 0; i < N - 1; i++) {
    sum2 -= A.at(i);
    sum -= 2 * A.at(i) * sum2;
  }
  cout << sum << endl;
}

#include <bits/stdc++.h>
using namespace std;
#define ll          long long 
#define hell        1000000007
const int nax=1e5+20;

int main(){

//  int t; cin >> t;

    int t = 1;

    while(t--){ 

        int n; cin >> n;
        
        map<ll, ll> cnt;
        ll ans = 0;
        
        for(int i = 0; i < n; i++) {
            ll x; 
            cin >> x;
            cnt[x]++;
        }
    
        for(int i = -200; i <= 200; i++) {
            for(int j = -200; j <= 200; j++) {
                ans += cnt[i]*cnt[j]*(i-j)*(i-j);
            }
        }
        
        ans /= 2;
        
        cout << ans;
        cout << endl;

    }    
    
    return 0;
}

