#include #include #include using namespace std; long long solve(vector X) { sort(X.begin(), X.end()); int x = X.at(X.size() / 2); long long ret = 0; for (int y : X) ret += abs(x - y); return ret; } int main() { int N; cin >> N; vector X(N), Y(N); for (int i = 0; i < N; ++i) cin >> X.at(i) >> Y.at(i); cout << solve(X) + solve(Y) << endl; }