':type picture: List[List[str]]
:type N: int
:rtype: int'

def findBlackPixel(self, picture, N):

    lookup = collections.Counter(map(tuple, picture))
    cols = [col.count('B') for col in zip(*picture)]
    return sum(((N * zip(row, cols).count(('B', N))) for (row, cnt) in lookup.iteritems() if (cnt == N == row.count('B'))))
