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

const int maxn = 100000 + 3;
int n, resx = 0, resy = 0;
int x[maxn], y[maxn];


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

    cin >> n;

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

    sort(x, x + n);
    sort(y, y + n);


    {
        int momsb = 0, momsq = 0;
        int now = 0, razs = 0;
        for(int i=1;i<n;i++){
            razs = x[i] - x[i - 1];

            now = momsq + 2 * razs * momsb + (razs + 1) * (razs * razs);
            resx += now;

            momsb = momsb + razs;
            momsq = momsq + razs * razs;
        }
    }

    {
        int momsb = 0, momsq = 0;
        int now = 0, razs = 0;
        for(int i=1;i<n;i++){
            razs = y[i] - y[i - 1];

            now = momsq + 2 * razs * momsb + (razs + 1) * (razs * razs);
            resy += now;

            momsb = momsb + razs;
            momsq = momsq + razs * razs;
        }
    }




    cout << resx + resy;

    return 0;
}