/*
Author: Pratik Bedre
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    int n;
    cin >> n;
    ll a[n];
    for (int i = 0; i < n; i++)
        cin >> a[i];
    ll sqsum = 0, sum = 0;
    for (int i = 0; i < n; i++)
        sqsum += a[i] * a[i];
    for (int i = 0; i < n; i++)
        sum += a[i];
    ll ans = 2 * sqsum * n - 2 * sum * sum;
    cout << ans / 2;
}
        #include <bits/stdc++.h>
        #define rep(i,cc,n) for(int i=cc;i<=n;++i)
        #define drep(i,cc,n) for(int i=cc;i>=n;--i)
        template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
        template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
        const long long INF = 1LL <<60;
        typedef long long ll;
        using namespace std;
         
        int main(){
            ll n;
            cin >> n;
         
            vector<int> a(n);
            map<int,ll> mp;
     
            rep(i,0,n-1){
                cin >> a[i];
                mp[a[i]]++;
            }
     
            ll sum = 0;
     
            rep(i,-200,200){
                rep(j,-200,200){
                    sum += (ll)mp[i] * mp[j] * (i-j) * (i-j);
                    //if(mp[i] > 0 && mp[j] > 0) cout << i << " " << j << endl;
                }
            }
     
            cout << sum / 2 << endl;
            return 0;
        }