#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i=0;i<(n);++i)
using ll = long long;
using P = pair<int, int>;
using C = complex<double>;


int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a.at(i);
	vector<ll> b(410);
	rep(i, n) b.at(a.at(i) + 200)++;

	ll ans = 0;
	for (ll i = 1; i < b.size(); i++) {
		for (ll j=0;j<i;j++){
			ans += b.at(i) * b.at(j) * (i - j) * (i - j);
		}
	}
	cout << ans << endl;

}
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;

    ll r = 0, s = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;

        s += a;
        r += a * a;
    }

    r *= n;
    r -= s * s;

    cout << r << endl;

    return 0;
}