count to store the total number of boomerangs.p in the list of points.d to store distances from point p to all other points.q, calculate the squared distance and increment its frequency in d.d and for each frequency f, add f * (f - 1) to count.d before moving to the next point p.count of boomerangs.