#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int N = 1e5 + 5;
long long temp[N];
int main()
{
    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n;i++)
    {
        int a;
        scanf("%d", &a);
        temp[a % 200]++;
    }
    long long ans = 0;
    for (int i = 0; i < 200;i++)
        ans += (temp[i] * (temp[i] - 1)) / 2;
    printf("%lld\n", ans);
}
#include<bits/stdc++.h>
#define re register int
#define ll long long
#define dl long double
#define LL ll
#define V inline void
#define I inline int
#define FOR(i,a,b) for(re i=(a),i##i=(b);i<=i##i;++i)
#define ROF(i,a,b) for(re i=(a),i##i=(b);i>=i##i;--i)
#define gc getchar()
//#define gc (fs==ft&&(ft=(fs=buf)+fread(buf,1,1<<18,stdin),fs==ft))?0:*fs++
using namespace std;
char *fs,*ft,buf[1<<18];
const int N=5e5+10,mo=998244353,G=3;
LL read(){
	ll p=0; bool w=0; char ch=gc;
	while(!isdigit(ch)) w=ch=='-',ch=gc;
	while(isdigit(ch)) p=p*10+ch-'0',ch=gc;
	return w?-p:p;
}
int n;
ll a[N],s1[N],s2[N],ans;
int main(){
	n=read();
	FOR(i,1,n) a[i]=read(),s1[i]=s1[i-1]+a[i],s2[i]=s2[i-1]+a[i]*a[i];
	FOR(i,2,n) ans+=a[i]*a[i]*(i-1)-2*a[i]*s1[i-1]+s2[i-1];
	cout<<ans;
	
	return 0;
}