#include<bits/stdc++.h>
using namespace std;

int n,x[100007],y[100007];
int pt1,pt2;
long long ans,curr;

int main(){
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>x[i]>>y[i];
    }
    sort(x+1,x+n+1);
    sort(y+1,y+n+1);

    for(int i=0;i<=20000;i++){
        pt1=pt2=1;
        curr=0;
        for(int f=1;f<=n;f++){
            if(pt1<f)pt1++;
            if(pt2<f)pt2++;

            while(pt1<=n and x[pt1]-x[f]<i)pt1++;
            while(pt2<=n and x[pt2]-x[f]<=i)pt2++;
            curr+=max(0,pt2-pt1);
        }
        pt1=pt2=1;
        for(int f=1;f<=n;f++){
            if(pt1<f)pt1++;
            if(pt2<f)pt2++;

            while(pt1<=n and y[pt1]-y[f]<i)pt1++;
            while(pt2<=n and y[pt2]-y[f]<=i)pt2++;
            curr+=max(0,pt2-pt1);
        }
        ans+=(long long) curr*i*i;
    }

    cout<<ans<<"\n";

    return 0;
}

