#include <bits/stdc++.h>
using namespace std;
long long n;
long long const maxn = 100005;

struct Point
{
    int x;
    int y;
};

long long ans[maxn];
Point points[maxn];
long long squares[maxn];

long long d(int a,int b)
{
    int xlen = abs(points[a].x - points[b].x);
    int ylen = abs(points[a].y - points[b].y);
    return squares[xlen]+squares[ylen];
}

void solve()
{
    ans[1]=0;
    for(int i=2; i<=n; i++)
    {
        ans[i]= ans[i-1];
        for(int j=1; j<=i; j++)
        {
            ans[i]+=d(i,j);
        }
    }
}


int main()
{
    cin>>n;

    for(int i=1; i<=n; i++)
    {
        cin>>points[i].x>>points[i].y;
        squares[i] = i*i;
    }
    solve();
    cout<<ans[n];
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

