#include <bits/stdc++.h>
#define endl '\n'

int n;
unsigned long long qsum, sum, temp;
std::array<int, 100001> x, y;
std::array<int, 100001> a;

unsigned long long solve(std::array<int, 100001> arr) {
    a[0] = 0;
    qsum = 0;
    sum = 0;
    temp = 0;
    for (int i = 1; i < n; ++ i) {
        a[i] = a[i - 1] + (arr[i] - arr[i - 1]);
        qsum += a[i] * a[i];
        sum += a[i];
    }
    for (int i = 0; i < n - 1; ++ i) {
        temp += a[i] * sum;
        sum -= a[i + 1];
    }
    return (n - 1) * qsum - 2 * temp;
}

int main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);
    std::cin >> n;
    for (int i = 0; i < n; ++ i) {
        std::cin >> x[i] >> y[i];
    }
    std::sort(x.begin(), x.begin() + n);
    std::sort(y.begin(), y.begin() + n);
    std::cout << solve(x) + solve(y) << endl;
    return 0;
}
