square count on Cartesian plane

Done too much of research bt cant find its detail algorithm for this qstn

u r given N points in Cartesian plane find number of square formed?? i have seen
discussion on Stack overflow for this qstn bt can’t find helpful so please give me detail algorithm.Pdf posted in that post is mathematical rather than focusing on algorithm Please help

DELETED

LIVE CONTEST

Thank you