#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

const ll Size=1e3+10;
vector<pair<ll,ll>> points;


void solve(){
    ll n,ans=0;
    cin>>n;
    for(ll i=0,x,y;i<n;i++){
        cin>>x>>y;
        for(ll j=points.size()-1;j>=0;j--){
            ans+=pow(x-points[j].first,2)+pow(y-points[j].second,2);
        }
        points.push_back({x,y});
    }
    cout<<ans<<endl;
}

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    ll t=1;
    while(t--){
        solve();
    }
    return 0;
}