///even.cpp
#include <bits/stdc++.h>
#define ednl "\n"
using namespace std;

long long a[100002],b[100002],sumA[100002],sumB[100002];
pair<long long,long long>ch[100002];

int main(){

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);

    long long n,ans=0,k=2,gh,mh;
    cin>>n;
    for(long long i=0;i<n;i++){
        cin>>mh>>gh;
       ch[i]=make_pair(mh,gh);
    }
    sort(ch,ch+n);
    a[1]=ch[0].first;
    b[1]=ch[0].second;
    for(long long i=1;i<=n;i++){
        if(ch[i].first==ch[k-2].first && ch[i].second==ch[k-2].second){
        }else{
            a[k]=ch[i].first;
            b[k]=ch[i].second;
            k++;
        }
    }
    //cout<<a[1]<<" - "<<b[1]<<endl;
    //cout<<a[2]<<" - "<<b[2]<<endl;
    //cout<<a[3]<<" - "<<b[3]<<endl;
    //cout<<k<<endl;
    if(k-2<n)n=k-2;
    for(long long i=1;i<=n;i++){
        sumA[i]=sumA[i-1]+a[i];
        sumB[i]=sumB[i-1]+b[i];
    }

    for(long long i=1;i<=n;i++){
        ans+=(n-1)*a[i]*a[i];
        ans=ans-2*a[i]*(sumA[n]-sumA[i]);
        ans+=(n-1)*b[i]*b[i];
        ans=ans-2*b[i]*(sumB[n]-sumB[i]);
    }
    cout<<ans<<endl;

    return 0;
}

