#include<bits/stdc++.h>
using namespace std;
#pragma optimise ("O3")
#pragma target ("sse4")
const long long MAXN=100007;
long long n;
struct point
{
    int x,y;
} pp[MAXN];
vector<int> xses[20007];
long long sbor[20007],sbor2[20007];
long long r1[MAXN],r2[MAXN];
long long ans=0;
int main()
{
    cin>>n;
    for (int q=0;q<n;q++) {cin>>pp[q].x>>pp[q].y;pp[q].x+=10000;pp[q].y+=10000;}
    for (int q=0;q<n;q++)
    {
        xses[pp[q].x].push_back(pp[q].y);
    }
    for (int q=0;q<20000;q++)
    {
        sort(xses[q].begin(),xses[q].end());
    }
    for (int q=0;q<20000;q++)
    {
        if (xses[q].size()>0)
        {
            //cout<<q<<" "<<xses[q].size()<<"\n";
            //for (int w=0;w<xses[q].size();w++) cout<<xses[q][w]<<" ";
            //cout<<"\n";
            r1[0]=0;
            r2[0]=0;
            long long sum=0;
            for (int w=1;w<xses[q].size();w++)
            {
                long long a=xses[q][w]-xses[q][w-1];
                r1[w]=a*w+r1[w-1];
                r2[w]=2*a*r1[w-1]+r2[w-1]+a*a*w;
                sum+=r2[w];
            }
            ans+=sum;
            //cout<<q<<" "<<sum<<"\n";

            for (int w=0;w<xses[q].size();w++)
            {
                sbor[q]+=xses[q][w];
                sbor2[q]+=xses[q][w]*xses[q][w];
            }
        }
    }
    for (int q=0;q<20000;q++)
    {
        if (xses[q].size()==0) continue;
        for (int w=q+1;w<20000;w++)
        {
            if (xses[w].size()==0) continue;
            ans+=(w-q)*(w-q)*xses[q].size()*xses[w].size();
            ans+=sbor2[q]*xses[w].size()-2*sbor[q]*sbor[w]+sbor2[w]*xses[q].size();
        }
    }
    cout<<ans<<"\n";
}

