#include <iostream>
#include <vector>
using namespace std;

int main(){
    int N;
    cin >> N;
    vector<int64_t> a(410, 0);
    for(int i = 0; i < N; i++){
        int x; 
        cin >> x;
        a[x + 200]++;
    }
    int64_t ans = 0;
    for(int i = 0; i <= 400; i++){
        for(int j = 0; j <= 400; j++){
            ans += (i - j)*(i - j)*a[i]*a[j];
        }
    }
    ans /= 2;
    cout << ans << endl;

}
#include <iostream>
#include <vector>

int main() {
	std::ios::sync_with_stdio(0);
	std::cin.tie(0);
	std::vector<long long> v1, v2, v3;
	long long cnt1 = 0, cnt2 = 0, ans = 0;
	int n, a;
	std::cin >> n;
	for (int i = 0; i < n; i++) {
		std::cin >> a;
		v3.push_back(a);
		cnt1 += a;
		cnt2 += a * a; 
		v1.push_back(cnt1);
		v2.push_back(cnt2);
	}
	for (int i = 1; i < n; i++) {
		ans += i * v3[i] * v3[i] - 2 * v3[i] * v1[i - 1] + v2[i - 1];
	}
	std::cout << ans;
	return 0;
}
