#include <iostream>
#include <cmath>
#include <utility>

using namespace std;

#define mp make_pair
#define x first
#define y second
typedef pair<int,int> pii;
typedef long long ll;

pii tocke[1003];

int main(){
	ios::sync_with_stdio(0);
	int n;
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>tocke[i].x>>tocke[i].y;
	}
	int br=0;
	for(int i=0;i<n-1;i++){
		for(int j=i+1;j<n;j++){
			if(abs(tocke[i].y-tocke[j].y)/abs(tocke[i].x-tocke[j].x)==0 or abs(tocke[i].y-tocke[j].y)==abs(tocke[i].x-tocke[j].x)) br++;
		}
	}
	cout<<br;



return 0;
}


#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
    ll n;
    cin>>n;
    vector<pair<ll,ll>>v;
    ll two=INT_MAX;
    for(int i=0;i<n;i++){
        ll a,b;
        cin>>a>>b;
        v.push_back(make_pair(a,b));
        two=min(two,a+b);
    }
    ll first=INT_MAX;
    ll second=INT_MAX;
    ll f2=INT_MAX;
    ll s2=INT_MAX;
    ll i=0,index=0;
    for(auto itr:v){
        if(itr.first<first){
            first=min(itr.first,first);
            index=i;
        } 
        i++;
    }
    i=0;
    for(auto itr:v){
        if(itr.second<second&&index!=i ){
            second=min(itr.second,second);
        } 
        i++;
    }
    i=0;
    index=0;
    for(auto itr:v){
        if(itr.first<f2){
            f2=min(itr.first,f2);
            index=i;
        } 
        i++;
    }
    i=0;
    for(auto itr:v){
        if(itr.second<s2&&index!=i ){
            s2=min(itr.second,s2);
        } 
        i++;
    }
    //cout<<first<<" "<<second<<" "<<f2<<" "<<s2<<" ";
    ll tmp=min(max(first,second),max(f2,s2));
    ll ans=min(two,tmp);
    cout<<ans<<"\n";
    return 0;
}