Curve touching Brep

Hello everyone,

I used an array of points to make a grid and then created a square from each point. Then I made boxes using some of the squares as base. I am trying to find a way to control if a square touches any of the boxes. Later on I want to count the boxes each square touches.

Does anyone have an idea? I am very new to grashopper and would really appreciate any help!

Best
Theodora

BrepCurve intersection.gh (14.5 KB)

Very helpfull thanks a lot!