#include <bits/stdc++.h>
using namespace std;
struct pont{
int x, y, ind;
};
struct el{
int cs, ert;
};
bool xszerint(pont j, pont i){
if(i.x == j.x) return i.y<j.y;
else return i.x<j.x;
}
bool yszerint(pont j, pont i){
if(i.y == j.y) return i.x<j.x;
else return i.y<j.y;
}
struct CompErt {
bool operator()(el const& p1, el const& p2)
{
// return "true" if "p1" is ordered
// before "p2", for example:
return p1.ert > p2.ert;
}
};
int main()
{
// ifstream cin("be.txt");
int n;
cin>>n;
vector<pont> a(n+1);
vector<vector<el>> szlista(n+1);
for(int i=1; i<=n; i++){
cin>>a[i].x>>a[i].y;
a[i].ind = i;
}
// for(int i=1; i<=n; i++){
// cout<<i<<": "<<a[i].x<<" "<<a[i].y<<endl;
// }
sort(a.begin()+1, a.end(), xszerint);
for(int i=1; i<n; i++){
if(a[i].x == a[i+1].x){
el seged;
seged.cs = a[i+1].ind;
seged.ert = abs(a[i].y - a[i+1].y);
szlista[a[i].ind].push_back(seged);
seged.cs = a[i].ind;
szlista[a[i+1].ind].push_back(seged);
}
}
sort(a.begin()+1, a.end(), yszerint);
for(int i=1; i<n; i++){
if(a[i].y == a[i+1].y){
el seged;
seged.cs = a[i+1].ind;
seged.ert = abs(a[i].x - a[i+1].x);
szlista[a[i].ind].push_back(seged);
seged.cs = a[i].ind;
szlista[a[i+1].ind].push_back(seged);
}
}
// for(int i=1; i<=n; i++)
// {
// cout<<i<<": ";
// for(el x:szlista[i]) cout<<x.cs<<" "<<x.ert<<", ";
// cout<<endl;
// }
vector<bool> lattam(n+1);
lattam[1] = 1;
int maxhossz = 0;
int maxhosszdb = 0;
priority_queue <el, vector<el>, CompErt> pq;
for(el x: szlista[1]) pq.push(x);
for(int i=1; i<n; ){
if(!lattam[pq.top().cs]){
lattam[pq.top().cs] = 1;
// cout<<pq.top().cs<<" ";
if(pq.top().ert > maxhossz){
maxhosszdb = 1;
maxhossz = pq.top().ert;
}
else if(pq.top().ert == maxhossz){
maxhosszdb++;
}
i++;
int csucs = pq.top().cs;
pq.pop();
for(el x: szlista[csucs]) pq.push(x);
//cout<<pq.top().cs<<" ";
}
//cout<<"*";
else pq.pop();
}
cout<<maxhossz<<'\n'<<maxhosszdb;
return 0;
}