using namespace std;
int n;
int x1,x2;
int y1,y2;
int x1c,x2c,y1c,y2c;
int mx,my;
struct{
int a,b;
}l[1000];
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>l[i].a>>l[i].b;
mx=max(l[i].a,mx);
my=max(l[i].b,my);//存一下最大值
}
int count=0;
for(int i=1;i<=mx;i++){
for(int j=1;j<=n;j++){
if(l[j].a==i) count++;
}
if(count>x1c){
x1c=count;
x1=i;
}
else if(count>x2c){
x2c=count;
x2=i;
}
count=0;//找两条点最多的
}
count=0;
for(int i=1;i<=my;i++){
for(int j=1;j<=n;j++){
if(l[j].b==i) count++;
}
if(count>y1c){
y1c=count;
y1=i;
}
else if(count>y2c){
y2c=count;
y2=i;
}
count=0;//找两条点最多的
}
int ans=x1c+x2c+y1c+y2c;
for(int i=1;i<=mx;i++){
if(l[i].a==x1){
if(l[i].b==y1) ans--;
if(l[i].b==y2) ans--;
}
if(l[i].a==x2){
if(l[i].b==y1) ans--;
if(l[i].b==y2) ans--;
}//有相交就减一
}
cout<<ans;
return 0;
}