Foreach point, call this a center point, group the other points into buckets where each bucket contains points that are the same distance from the center point. Each bucket with more than 1 point can make boomerangs.

How many boomerangs can a bucket make?

Each point in a bucket can make a boomerang with all other points in the bucket. A bucket with N points, can make N * (N - 1) boomerangs.

```
public int NumberOfBoomerangs(int[,] points)
{
int n = points.GetLength(0);
int count = 0;
for (int p0 = 0; p0 < n; p0++)
{
// Keep a lookup of the distance from p0 to all other points
// if you find another point with same distance give that distance
// a count of 1 (one other point), if you see another point of this
// distance move count to 2 and so on.
Dictionary<int,int> distSqMap = new Dictionary<int,int>();
for (int p1 = 0; p1 < n; p1++)
{
if (p1 == p0) continue;
// avoid square root calculation - do distance check against distance square
int distSq = (points[p0,0] - points[p1,0])*(points[p0,0] - points[p1,0])
+ (points[p0,1] - points[p1,1])*(points[p0,1] - points[p1,1]);
if (!distSqMap.ContainsKey(distSq))
{
distSqMap[distSq] = 0;
}
else
{
distSqMap[distSq]++;
}
}
// count number of combinations for groups of equally distanced points
foreach (int groupCount in distSqMap.Values)
{
count += groupCount * (groupCount + 1);
}
}
return count;
}
```