#include<bits/stdc++.h>
#define x first
#define y second
#define pb push_back
#define IOS ios::sync_with_stdio(false);cin.tie(0);
using namespace std;
typedef unsigned long long ULL;
typedef pair<int,int> PII;
typedef pair<long,long> PLL;
typedef pair<char,char> PCC;
typedef long long LL;
const int N=2*1e5+10;
const int M=150;
const int INF=0x3f3f3f3f;
const int MOD=998244353;
int xx[N],yy[N];
map<int,int> x_count,y_count;
map<PII,int> pair_count;
void solve(){
int n;cin>>n;
int same=0;
for(int i=0;i<n;i++){
cin>>xx[i]>>yy[i];
pair_count[{xx[i],yy[i]}]++;
x_count[xx[i]]++;
y_count[yy[i]]++;
}
LL ans=0;
for(auto ff : x_count){
if(ff.y>=2) ans+=(LL)ff.y*(ff.y-1)/2;
}
for(auto ff : y_count){
if(ff.y>=2) ans+=(LL)ff.y*(ff.y-1)/2;
}
for(auto ff : pair_count){
ans-=(LL)ff.y*(ff.y-1)/2;
}
cout<<ans<<endl;
}
int main(){
IOS;
solve();
return 0;
}