#include<bits/stdc++.h>
#include<fstream>
using namespace std;
ifstream fin("VNOICUP.INP");
ofstream fout("VNOICUP.OUT");
#define sz(a) (int)a.size()
#define ll long long
#define pb push_back
#define forr(i, a, b) for(int i = a; i < b; i++)
#define dorr(i, a, b) for(int i = a; i >= b; i--)
#define ld long double
#define vt vector
#include<fstream>
#define fi first
#define se second
#define pll pair<ll, ll>
#define pii pair<int, int>
#define mp make_pair
const ld PI = 3.14159265359;
using u128 = __uint128_t;
//const int x[4] = {1, -1, 0, 0};
//const int y[4] = {0, 0, 1, -1};
const ll mod = 1e9 + 7;
const int mxn = 1e5 + 5, mxq = 2e5 + 5, sq = 400, mxv = 15 * 10, pr = 31;
const int base = (1 << 18);
const ll inf = 2e9, neg = -69420, add = 1e9;
int n;
signed main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n;
vt<ll>a(n), b(n);
for(int i = 0; i < n; i++){
ll x, y; cin >> x >> y;
a[i] = (x + y); b[i] = (x - y);
}
sort(a.begin(), a.end()); sort(b.begin(), b.end());
ll ma = a[sz(a) / 2], mb = b[sz(b) / 2];
ll res = 1e18;
for(auto [pa, pb]: {mp(ma, mb), mp(ma - 1, mb), mp(ma + 1, mb), mp(ma, mb - 1), mp(ma, mb + 1)}){
if((pa + pb) & 1)continue;
ll ans = 0;
for(int i = 0; i < sz(a); i++){
//cout << a[i] << " ";
ans += abs(a[i] - pa);
}
forr(i, 0, sz(b)){
// cout << b[i] << " ";
ans += abs(b[i] - pb);
}
res = min(res, ans);
}
assert(res % 2 == 0);
cout << res / 2;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KI2luY2x1ZGU8ZnN0cmVhbT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKaWZzdHJlYW0gZmluKCJWTk9JQ1VQLklOUCIpOwpvZnN0cmVhbSBmb3V0KCJWTk9JQ1VQLk9VVCIpOwojZGVmaW5lIHN6KGEpIChpbnQpYS5zaXplKCkKI2RlZmluZSBsbCBs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c29ydChhLmJlZ2luKCksIGEuZW5kKCkpOyBzb3J0KGIuYmVnaW4oKSwgYi5lbmQoKSk7CiAgICBsbCBtYSA9IGFbc3ooYSkgLyAyXSwgbWIgPSBiW3N6KGIpIC8gMl07CiAgICBsbCByZXMgPSAxZTE4OwogICAgZm9yKGF1dG8gW3BhLCBwYl06IHttcChtYSwgbWIpLCBtcChtYSAtIDEsIG1iKSwgbXAobWEgKyAxLCBtYiksIG1wKG1hLCBtYiAtIDEpLCBtcChtYSwgbWIgKyAxKX0pewogICAgICAgIGlmKChwYSArIHBiKSAmIDEpY29udGludWU7CiAgICAgICAgbGwgYW5zID0gMDsKICAgICAgICBmb3IoaW50IGkgPSAwOyBpIDwgc3ooYSk7IGkrKyl7CiAgICAgICAgLy9jb3V0IDw8IGFbaV0gPDwgIiAiOwogICAgICAgICAgICAgYW5zICs9IGFicyhhW2ldIC0gcGEpOwogICAgICAgIH0KICAgICAgICBmb3JyKGksIDAsIHN6KGIpKXsKICAgICAgIC8vIGNvdXQgPDwgYltpXSA8PCAiICI7CiAgICAgICAgICAgIGFucyArPSBhYnMoYltpXSAtIHBiKTsKICAgICAgICB9CiAgICAgICAgcmVzID0gbWluKHJlcywgYW5zKTsKICAgIH0KICAgIAogICAgYXNzZXJ0KHJlcyAlIDIgPT0gMCk7CiAgICBjb3V0IDw8IHJlcyAvIDI7Cn0=