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

vector <pair<int, int>> points;
vector <int> multiply;

unsigned long long distance(int i, int j)
{
    int a=abs(points[i].first-points[j].first);
    int b=abs(points[i].second-points[j].second);
    unsigned long long d=a*a+b*b;
    return d;
}



int main()
{
    int n;
    cin >> n;

    pair <int, int> help;

    for(int i=0; i<n; i++)
    {
        cin >> help.first >> help.second;
        points.push_back(help);
    }


    sort(points.begin(), points.end());

    int index=0;
    int counter=1;

    while(index<points.size()-1)
    {
        if(points[index].first==points[index+1].first && points[index+1].second==points[index].second)
        {
            points.erase(points.begin()+index+1);
            counter++;
        }
        else
        {
            index++;
            multiply.push_back(counter);
            counter=1;
        }
    }
    multiply.push_back(counter);
    unsigned long long result=0;
    for(int i=0; i<points.size()-1; i++)
    {
        for(int j=i; j<points.size(); j++)
        {
            result+=distance(i, j)*multiply[i]*multiply[j];
        }
    }

    cout << result;

    return 0;
}
