#include using namespace std; using ll = long long; #define REP(i, n) for (int i = 0; i < (n); i++) template using V = vector; template ostream &operator<<(ostream &os, const V &v) { os << "[ "; for (auto &vi: v) os << vi << ", "; return os << "]"; } template ostream &operator<<(ostream &os, const pair &p) { return os << "{ " << p.first << ", " << p.second << "}"; } #ifdef LOCAL #define show(x) cerr << __LINE__ << " : " << #x << " = " << x << endl; #else #define show(x) true #endif int main() { int N; cin >> N; vector X(N), Y(N); REP(i, N) cin >> X[i] >> Y[i]; sort(X.begin(), X.end()); sort(Y.begin(), Y.end()); int x = X[N / 2], y = Y[N / 2]; long long ans = 0; REP(i, N) ans += abs(X[i] - x) + abs(Y[i] - y); cout << ans << '\n'; return 0; }