import numpy as np
import re as re
def entry(grid):
hrid = np.array(grid).transpose().tolist()
g = [(p*3+1,q.start(),~-q.end()) for p,r in enumerate(grid) for q in re.finditer('1(, 1)+',str(r))]
h = [(p*3+1,q.start(),~-q.end()) for p,r in enumerate(hrid) for q in re.finditer('1(, 1)+',str(r))]
count = 0
for a, b, c in g:
for d, e, f in h:
if b <= d < c and e <= a < f:
for u, v, w in g:
if a < u <= f and v <= d < w:
for x, y, z in h:
if y <= a and u <= z and d < x <= c and v < x <= w:
count = count + 1 # increments count by one
return count