H, W, K = list(map(int, input().split()))

C = [[1 if c == "#" else 0 for c in eval(input())] for _ in range(H)]

ans = 0

for bith in range(1 << H):

    for bitw in range(1 << W):

        c = [x[:] for x in C]

        for h in range(H):

            if bith & (1 << h):

                c[h] = [0] * W

        for w in range(W):

            if bitw & (1 << w):

                for h in range(H):

                    c[h][w] = 0

        count = sum(sum(x) for x in c)

        if count == K:

            ans += 1

print(ans)
H, W, K = list(map(int, input().split()))

M = [[1 if c == "#" else 0 for c in eval(input())] for _ in range(H)]



ans = 0

for hselection in range(1 << H):

    for wselection in range(1 << W):

        count = 0

        for h in range(H):

            if hselection & (1 << h):

                continue

            for w in range(W):

                if wselection & (1 << w):

                    continue

                count += M[h][w]

        if count == K:

            ans += 1

print(ans)
H, W, K = list(map(int, input().split()))
C = [[1 if c == "#" else 0 for c in eval(input())] for _ in range(H)]
ans = 0
for bith in range(1 << H):
    for bitw in range(1 << W):
        c = [x[:] for x in C]
        for h in range(H):
            if bith & (1 << h):
                c[h] = [0] * W
        for w in range(W):
            if bitw & (1 << w):
                for h in range(H):
                    c[h][w] = 0
        count = sum(sum(x) for x in c)
        if count == K:
            ans += 1
print(ans)

H, W, K = list(map(int, input().split()))
M = [[1 if c == "#" else 0 for c in eval(input())] for _ in range(H)]
ans = 0
for hselection in range(1 << H):
    for wselection in range(1 << W):
        count = 0
        for h in range(H):
            if hselection & (1 << h):
                continue
            for w in range(W):
                if wselection & (1 << w):
                    continue
                count += M[h][w]
        if count == K:
            ans += 1
print(ans)

-C = [[1 if c == "#" else 0 for c in eval(input())] for _ in range(H)] +M = [[1 if c == "#" else 0 for c in eval(input())] for _ in range(H)] -for bith in range(1 << H): -    for bitw in range(1 << W): -        c = [x[:] for x in C] +for hselection in range(1 << H): +    for wselection in range(1 << W): +        count = 0 -            if bith & (1 << h): -                c[h] = [0] * W -        for w in range(W): -            if bitw & (1 << w): -                for h in range(H): -                    c[h][w] = 0 -        count = sum(sum(x) for x in c) +            if hselection & (1 << h): +                continue +            for w in range(W): +                if wselection & (1 << w): +                    continue +                count += M[h][w]