#include<iostream>
#include<algorithm>
using namespace std;
const int N = 410, offset = 200;
int a[N];

int main(){
    int n;
    cin >> n;
    while(n--){
        int x;
        cin >> x;
        a[x + offset]++;
    }
    long long ans = 0;
    for(int i = 0; i <= 400; i++){
        for(int j = i; j <= 400; j++){
            int c1 = a[i], c2 = a[j];
            if(c1 && c2) ans += (i - j) * (i - j) * c1 * c2;       
        }
        
    }
    printf("%lld", ans);
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
void DAU(const string &task = "") {
    if (!task.empty())
        freopen((task + ".in").c_str(), "r", stdin),
        freopen((task + ".out").c_str(), "w", stdout);
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
}
void PLEC() {
    exit(0);
}
#define int long long
int n, s1, s2, x, res;
signed main() {
    DAU();
    cin >> n;
    for (int i = 1; i <= n; ++i) {
        cin >> x;
        s1 += x * x;
        s2 += x;
    }
    res = n * s1 - s2 * s2;
    cout << res;
    PLEC();
}
