#include <bits/stdc++.h>
#define ALL(a) a.begin(), a.end()
#define ALLR(a) a.rbegin(), a.rend()
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORD(i, a, b) for (int i = (a); i > (b); i--)
#define REP(i, n) for (int i = 0; i < (n); i++)
#define REPR(i, n) for (int i = (n)-1; i >= 0; i--)
#define SI(a) (int)a.size()
using namespace std;
using ll = long long;
template <class T>
bool chmax(T &a, T b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}
template <class T>
bool chmin(T &a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
ll llceil(ll a, ll b) { return (a + b - 1) / b; }
ll shift(ll a) { return 1LL << a; }
const int INF = shift(30);
const ll LINF = shift(60);

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i, n) cin >> a[i];

  ll ans = 0;
  const int max_a = 200;
  vector<int> m(max_a * 2 + 1);
  REP(i, n) {
    FOR(j, -max_a, max_a + 1) {
      ll num = m[j + max_a];
      ll dif = a[i] - j;
      ans += dif * dif * num;
    }
    m[max_a + a[i]]++;
  }
  cout << ans << endl;
}
#include<bits/stdc++.h>
#define int long long
using namespace std;
typedef long long ll;
const int inf=0x3f3f3f3f;
const ll INF=0x3f3f3f3f3f3f3f3f;
const ll mod=1e9+7;
const int N=300010;
int n,ans,a[N],vis[N];
void init(){
	memset(a,0,sizeof(a));
	memset(vis,0,sizeof(vis));
	n=ans=0;
}
void solve(){
	init();
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>a[i];
		ans+=vis[a[i]+200];
		for(int j=0;j<=400;j++){
			vis[j]+=(j-200-a[i])*(j-200-a[i]);
		}
	}
	cout<<ans<<endl;
}
signed main(){
	ios::sync_with_stdio(false);
	cout.tie(NULL);
	int t;
	t=1;
	//cin>>t;
	while(t--){
		solve();
	}
	return 0;//完结撒花
}
