Similar to @ALEXANDER 's solution. Take advantage of `dot`

method in `NumPy`

to count how many 1s in the same column between two distinct rows:

```
import numpy as np
import itertools
class Solution(object):
def countCornerRectangles(self, grid):
"""
:type grid: List[List[int]]
:rtype: int
"""
m=np.array(grid)
counter=0
for (y0,y1) in itertools.combinations(m,2):
ones=np.dot(y0,y1)
counter+=ones*(ones-1)/2
return int(counter)
```