#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
void SOLVE() {
int n; cin >> n;
vector<pair<int, int>> a(n);
map<int, int> x, y;
for(auto &[u, v] : a){
cin >> u >> v;
x[u]++;
y[v]++;
}
ll answer = 0;
for(auto &[u, v] : a){
answer += (x[u] - 1) * 1LL * (y[v] - 1);
}
cout << answer << endl;
}
signed main(){
ios_base::sync_with_stdio(false); cout.tie(nullptr); cin.tie(nullptr);
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
int o_o = 1; //cin >> o_o;
while(o_o --) SOLVE();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |