import itertools

import numpy as np



h, w, k = list(map(int, input().split()))

c = [eval(input()) for _ in range(h)]



count = 0

for ph in itertools.product([0, 1], repeat=h):

    for pw in itertools.product([0, 1], repeat=w):

        squares = np.array([[1 if cell == '#' else -1 for cell in row] for row in c])

        squares[np.array(ph) == 1, :] *= 0

        squares[:, np.array(pw) == 1] *= 0

        count += np.count_nonzero(squares == 1) == k



print(count)

h, w, k = list(map(int, input().split()))

c = [eval(input()) for _ in range(h)]



count = 0

for binh in range(2**h):

    for binw in range(2**w):

        redh, redw = bin(binh)[2:].zfill(h), bin(binw)[2:].zfill(w)  # remove suffix '0x'

        squares = [list(row) for row in c]

        for i, rh in enumerate(redh):

            for wh in range(w):

                if rh == '1':

                    squares[i][wh] = '*'

        for j, rw in enumerate(redw):

            for hw in range(h):

                if rw == '1':

                    squares[hw][j] = '*'

        count += sum(row.count('#') for row in squares) == k



print(count)

import itertools
import numpy as np

h, w, k = list(map(int, input().split()))
c = [eval(input()) for _ in range(h)]
count = 0
for ph in itertools.product([0, 1], repeat=h):
    for pw in itertools.product([0, 1], repeat=w):
        squares = np.array([[1 if cell == "#" else -1 for cell in row] for row in c])
        squares[np.array(ph) == 1, :] *= 0
        squares[:, np.array(pw) == 1] *= 0
        count += np.count_nonzero(squares == 1) == k
print(count)

h, w, k = list(map(int, input().split()))
c = [eval(input()) for _ in range(h)]
count = 0
for binh in range(2**h):
    for binw in range(2**w):
        redh, redw = bin(binh)[2:].zfill(h), bin(binw)[2:].zfill(
            w
        )  # remove suffix '0x'
        squares = [list(row) for row in c]
        for i, rh in enumerate(redh):
            for wh in range(w):
                if rh == "1":
                    squares[i][wh] = "*"
        for j, rw in enumerate(redw):
            for hw in range(h):
                if rw == "1":
                    squares[hw][j] = "*"
        count += sum(row.count("#") for row in squares) == k
print(count)

-import itertools -import numpy as np - -for ph in itertools.product([0, 1], repeat=h): -    for pw in itertools.product([0, 1], repeat=w): -        squares = np.array([[1 if cell == "#" else -1 for cell in row] for row in c]) -        squares[np.array(ph) == 1, :] *= 0 -        squares[:, np.array(pw) == 1] *= 0 -        count += np.count_nonzero(squares == 1) == k +for binh in range(2**h): +    for binw in range(2**w): +        redh, redw = bin(binh)[2:].zfill(h), bin(binw)[2:].zfill( +            w +        )  # remove suffix '0x' +        squares = [list(row) for row in c] +        for i, rh in enumerate(redh): +            for wh in range(w): +                if rh == "1": +                    squares[i][wh] = "*" +        for j, rw in enumerate(redw): +            for hw in range(h): +                if rw == "1": +                    squares[hw][j] = "*" +        count += sum(row.count("#") for row in squares) == k