#include"bits/stdc++.h"

using namespace std;

typedef long long ll;

const int A_MAX = 200;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
    int N;
    cin >> N;
    ll ans = 0;
    vector<int>A(N);
    vector<int>K(A_MAX*2+1);
    for (int i = 0; i < N; i++){
        cin >> A[i];
    }

    for (int i = 0; i < N; i++){
        for (int j = -A_MAX; j <= A_MAX; j++){
            int b = K[A_MAX+j];
            int c = A[i] - j;
            ans += (ll)c*c*b;
        }
        K[A_MAX+A[i]]++;    
    }
    
    cout << ans << endl;
    
	return 0;
}
#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define endl "\n"
#define scd(a) scanf("%d",&a)
#define scdd(a,b) scanf("%d%d",&a,&b)
#define scddd(a,b,c) scanf("%d%d%d",&a,&b,&c)
const ll INF = (ll)0x3f3f3f3f3f3f3f, MAX = 9e18, MIN = -9e18;
const double PI=acos(-1.0);
const double eps=1e-6;
const ll mod=1e9+7;
const int inf=0x3f3f3f3f;
const int maxn=1e6+10;
const int maxm=100+10;
#define ios ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
#define lowbit(x) (x&(-x))
using namespace std;
ll n,m,k;
ll a[maxn];
void run_case(){
    ios;
    int _;
    _ = 1;
    while(_--){
         cin>>n;
         ll ans = 0;
         ll sum = 0;
         for(int i = 1; i<=n; i++){
            cin>>a[i];
            sum+=a[i];
            ans += (a[i]*a[i]*(n-1));
         }
         for(int i = 1; i<=n; i++){
            sum-=a[i];
            ll res = (sum)*a[i]*2;
            ans -= res;
         }
         cout<<ans<<endl;

            
    }
}

int main(){
    ios;
    run_case();
}