Triangle and Square Counting Part2