#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main (){
    int N;
    cin >> N;
    vector<pair<int,int>> t (N);
    for(int i=0; i<N; i++){
        cin >> t[i].first >> t[i].second;
    }
    ll ans=0;
    for(int i=0; i<N; i++){
        int x=0;
        int y=0;
        for(int j=0; j< N; j++){
            if(t[i].first==t[j].first && t[i].second == t[j].second)continue;
            if(t[i].first==t[j].first) y++;
            if(t[i].second==t[j].second) x++;
        }
        if(x==0 || y ==0)continue;
        ans += max(x,y);
    }
    cout << ans <<endl;
    
}
| # | Verdict  | Execution time | Memory | Grader output | 
|---|
| Fetching results... |