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

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

a=0

for i in range(2**h):

  for j in range(2**w):

    t=0

    for k in range(h):

      for l in range(w):

        if i>>k&1 and j>>l&1 and c[k][l]=='#': t+=1

    if t==x: a+=1

print(a)
h,w,x=list(map(int,input().split()))

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

print((sum(x==sum(i>>k&1 and j>>l&1 and c[k][l]=='#' for k in range(h) for l in range(w)) for i in range(2**h) for j in range(2**w))

))
h, w, x = list(map(int, input().split()))
c = [eval(input()) for _ in range(h)]
a = 0
for i in range(2**h):
    for j in range(2**w):
        t = 0
        for k in range(h):
            for l in range(w):
                if i >> k & 1 and j >> l & 1 and c[k][l] == "#":
                    t += 1
        if t == x:
            a += 1
print(a)

h, w, x = list(map(int, input().split()))
c = [eval(input()) for _ in [0] * h]
print(
    (
        sum(
            x
            == sum(
                i >> k & 1 and j >> l & 1 and c[k][l] == "#"
                for k in range(h)
                for l in range(w)
            )
            for i in range(2**h)
            for j in range(2**w)
        )
    )
)

-c = [eval(input()) for _ in range(h)] -a = 0 -for i in range(2**h): -    for j in range(2**w): -        t = 0 -        for k in range(h): -            for l in range(w): -                if i >> k & 1 and j >> l & 1 and c[k][l] == "#": -                    t += 1 -        if t == x: -            a += 1 -print(a) +c = [eval(input()) for _ in [0] * h] +print( +    ( +        sum( +            x +            == sum( +                i >> k & 1 and j >> l & 1 and c[k][l] == "#" +                for k in range(h) +                for l in range(w) +            ) +            for i in range(2**h) +            for j in range(2**w) +        ) +    ) +)