':type points: List[List[int]]
:rtype: int'

def numberOfBoomerangs(self, points):

    result = 0
    for i in xrange(len(points)):
        group = collections.defaultdict(int)
        for j in xrange(len(points)):
            if (j == i):
                continue
            (dx, dy) = ((points[i][0] - points[j][0]), (points[i][1] - points[j][1]))
            group[((dx ** 2) + (dy ** 2))] += 1
        for (_, v) in group.iteritems():
            if (v > 1):
                result += (v * (v - 1))
    return result
