Right angled triangle

sir can i get code for this question?

#include<bits/stdc++.h>
using namespace std;

unordered_map<int, int> x_cnt, y_cnt;

int main()
{
	int n;
	cin >> n;

	vector<int> x(n), y(n);

	for (int i = 0; i < n; ++i) {
		cin >> x[i] >> y[i];
		x_cnt[x[i]]++;
		y_cnt[y[i]]++;
	}

	int ans = 0;
	for (int i = 0; i < n; ++i) {
		ans += (x_cnt[x[i]] - 1) * (y_cnt[y[i]] - 1);
	}
	cout << ans;
	return 0;
}