#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define endl '\n'
#define int long long
#define MAXN 100005
int br;
vector<int> x, y;
int val[MAXN], sum[MAXN];
int sq(int p)
{
    return p * p;
}
int calculate(vector<int>& v)
{
    int res = 0;
    val[1] = sq(v[1] - v[0]); res += val[1]; sum[1] = v[1] - v[0];
    for(int i = 2; i < v.size(); ++i){
        int dif = v[i] - v[i - 1];
        int r = val[i - 1] + 2 * dif * sum[i - 1] + (i - 1) * sq(dif) + sq(dif);
        sum[i] = sum[i - 1] + (i - 1) * dif + dif;
        res += r; val[i] = r;
       // cout << val[i] << ' ' << sum[i] << ' ' << res << endl;
    }
    //cout << res << endl;
    return res;
}
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> br;
    if(br == 1){
        cout << 0 << endl; return 0;
    }
    for(int i = 0; i < br; ++i){
        int a, b; cin >> a >> b;
        x.push_back(a); y.push_back(b);
    }
    sort(x.begin(), x.end());
    sort(y.begin(), y.end());
    int ret = calculate(x) + calculate(y);
    cout << ret << endl;
    return 0;
}
