We have a grid of H rows and W columns of squares. The color of the square at the i-th row from the top and the j-th column from the left (1 \leq i \leq H, 1 \leq j \leq W) is given to you as a character c_{i,j}: the square is white if c_{i,j} is `.`, and black if c_{i,j} is `#`.  Consider doing the following operation:    * Choose some number of rows (possibly zero), and some number of columns (possibly zero). Then, paint red all squares in the chosen rows and all squares in the chosen columns.  You are given a positive integer K. How many choices of rows and columns result in exactly K black squares remaining after the operation? Here, we consider two choices different when there is a row or column chosen in only one of those choices.
import numpy as np
H,W,K = map(int,input().split())

a = [list(input()) for _ in range(H)] 

print(a)
count = 0
ans = 0
for i in range(2**W): 
    for j in range(2**H): 
        count = 0
        for s in range(H):
            for t in range(W):
                if(i >> s)&1 and (j>>t) & 1 and a[s][t] =="#":
                    count += 1
            if count == K:
                ans += 1
print(ans)
H,W,K = map(int,input().split())

a = [list(input()) for _ in range(H)] 


ans = 0
for i in range(2**H): 
    for j in range(2**W): 
        count = 0
        for s in range(H):
            for t in range(W):
                if(i >> s)&1 and (j>>t) & 1 and a[s][t] =="#":
                    count += 1
        if count == K:
            ans += 1
print(ans)