```
class Solution {
public:
int numberOfBoomerangs(vector<pair<int, int>>& points) {
int count = 0;
for (auto cur_pt : points) {
map<double, int> distance;
for (auto otr_pt : points)
if (cur_pt != otr_pt)
distance[pow(otr_pt.first - cur_pt.first, 2) + pow(otr_pt.second - cur_pt.second, 2)]++;
for (auto dis : distance)
if (dis.second > 1)
count += dis.second * (dis.second - 1);
}
return count;
}
};
```