#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define vint vector <int>
#define vll vector <ll>
#define vbool vector<bool>
#define pairint pair<int,int>
#define pairll pair<ll,ll>
#define fi first
#define sc second
#define rever greater<ll>()
using namespace std;
void solve(ll tc){
ll n; cin >> n;
map<ll, ll> x, y;
vll a(n), b(n);
for(int i = 0; i < n; i++){
cin >> a[i] >> b[i];
if(x[a[i]] == x[1000000000]){
x[a[i]] = 1;
}else{
x[a[i]]++;
}
if(y[b[i]] == y[1000000000]){
y[b[i]] = 1;
}else{
y[b[i]]++;
}
}
ll res = 0;
for(int i = 0; i < n; i++){
res += (x[a[i]]-1) * (y[b[i]]-1);
}
cout << res << endl;
}
int main(){
ll t; t = 1;
for(int i = 1; i <= t; i++){
solve(i);
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |