#include <iostream>
#include <algorithm>
using namespace std;
const int MAXN=1e5+10;
struct Point {
    long long x, y;
};
Point p[MAXN];
long long dif[MAXN], pr[MAXN];
bool cmpx(Point a, Point b) {
    if (a.x!=b.x) return a.x<b.x;
    return a.y<b.y;
}
bool cmpy(Point a, Point b) {
    if (a.y!=b.y) return a.y<b.y;
    return a.x<b.y;
}
long long solve(int n) {
    long long ans, add;
    ans=add=dif[0]*dif[0];
    pr[0]=dif[0];
    for (int i=1;i<n-1;i++) {
        add+=(i+1)*dif[i]*dif[i];
        pr[i]=pr[i-1]+(i+1)*dif[i];
        add+=2*dif[i]*pr[i-1];
        ans+=add;
    }
    return ans;
}
int main () {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    for (int i=0;i<n;i++) {
        cin >> p[i].x >> p[i].y;
    }
    sort(p,p+n,cmpx);
    for (int i=0;i<n-1;i++) dif[i]=p[i+1].x-p[i].x;
    long long ans;
    ans=solve(n);
    sort(p,p+n,cmpy);
    for (int i=0;i<n-1;i++) dif[i]=p[i+1].y-p[i].y;
    ans+=solve(n);
    cout << ans << endl;
    return 0;
}
