1 /**************************************************************
2 Problem: 3210
3 User: Tunix
4 Language: C++
5 Result: Accepted
6 Time:152 ms
7 Memory:2052 kb
8 ****************************************************************/
9
10 //BZOJ 3210
11 #include<vector>
12 #include<cstdio>
13 #include<cstring>
14 #include<cstdlib>
15 #include<iostream>
16 #include<algorithm>
17 #define rep(i,n) for(int i=0;i<n;++i)
18 #define F(i,j,n) for(int i=j;i<=n;++i)
19 #define D(i,j,n) for(int i=j;i>=n;--i)
20 #define pb push_back
21 using namespace std;
22 inline int getint(){
23 int v=0,sign=1; char ch=getchar();
24 while(ch<‘0‘||ch>‘9‘){ if (ch==‘-‘) sign=-1; ch=getchar();}
25 while(ch>=‘0‘&&ch<=‘9‘){ v=v*10+ch-‘0‘; ch=getchar();}
26 return v*sign;
27 }
28 const int N=1e5+10,INF=~0u>>2;
29 typedef long long LL;
30 /******************tamplate*********************/
31 int n,a[N],b[N];
32 LL Check(int x,int y){
33 LL ans=0;
34 F(i,1,n) ans+=abs(x-a[i])+abs(y-b[i]);
35 return ans;
36 }
37 int main(){
38 #ifndef ONLINE_JUDGE
39 freopen("3210.in","r",stdin);
40 freopen("3210.out","w",stdout);
41 #endif
42 n=getint();
43 F(i,1,n){
44 int x=getint(),y=getint();
45 a[i]=x+y; b[i]=x-y;
46 }
47 sort(a+1,a+n+1);
48 sort(b+1,b+n+1);
49 int x=a[n+1>>1],y=b[n+1>>1];
50 if ((x^y)&1)
51 printf("%lld\n",min(min(Check(x+1,y),Check(x,y+1)),
52 min(Check(x-1,y),Check(x,y-1)))/2);
53 else
54 printf("%lld\n",Check(x,y)/2);
55 return 0;
56 }