from itertools import product

from copy import deepcopy



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

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



ans = 0

for row in product(['.', '%'], repeat=H):

    if row == tuple(['%']*H):

        continue

    tmp1 = deepcopy(board)

    for h in range(H):

        if row[h] == '%':

            tmp1[h] = ['%']*W

    for col in product(['.', '%'], repeat=W):

        if col == tuple(['%']*W):

            continue

        tmp2 = deepcopy(tmp1)

        for w in range(W):

            if col[w] == '%':

                for h in range(H):

                    tmp2[h][w] = '%'

        if sum(tmp2, []).count('#') == K:

            ans += 1

print(ans)

from itertools import product



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

# 黒なら1

board = [[1 if x == '#' else 0 for x in list(eval(input()))] for _ in range(H)]



ans = 0

# 塗らないなら1

for row in product([0, 1], repeat=H):

    for col in product([0, 1], repeat=W):

        # 元が黒でタテヨコ塗らないマスを数える

        blacks = sum([board[h][w] * row[h] * col[w] for h in range(H) for w in range(W)])

        if blacks == K:

            ans += 1

print(ans)

from itertools import product
from copy import deepcopy

H, W, K = list(map(int, input().split()))
board = [list(eval(input())) for _ in range(H)]
ans = 0
for row in product([".", "%"], repeat=H):
    if row == tuple(["%"] * H):
        continue
    tmp1 = deepcopy(board)
    for h in range(H):
        if row[h] == "%":
            tmp1[h] = ["%"] * W
    for col in product([".", "%"], repeat=W):
        if col == tuple(["%"] * W):
            continue
        tmp2 = deepcopy(tmp1)
        for w in range(W):
            if col[w] == "%":
                for h in range(H):
                    tmp2[h][w] = "%"
        if sum(tmp2, []).count("#") == K:
            ans += 1
print(ans)

from itertools import product

H, W, K = list(map(int, input().split()))
# 黒なら1
board = [[1 if x == "#" else 0 for x in list(eval(input()))] for _ in range(H)]
ans = 0
# 塗らないなら1
for row in product([0, 1], repeat=H):
    for col in product([0, 1], repeat=W):
        # 元が黒でタテヨコ塗らないマスを数える
        blacks = sum(
            [board[h][w] * row[h] * col[w] for h in range(H) for w in range(W)]
        )
        if blacks == K:
            ans += 1
print(ans)

-from copy import deepcopy -board = [list(eval(input())) for _ in range(H)] +# 黒なら1 +board = [[1 if x == "#" else 0 for x in list(eval(input()))] for _ in range(H)] -for row in product([".", "%"], repeat=H): -    if row == tuple(["%"] * H): -        continue -    tmp1 = deepcopy(board) -    for h in range(H): -        if row[h] == "%": -            tmp1[h] = ["%"] * W -    for col in product([".", "%"], repeat=W): -        if col == tuple(["%"] * W): -            continue -        tmp2 = deepcopy(tmp1) -        for w in range(W): -            if col[w] == "%": -                for h in range(H): -                    tmp2[h][w] = "%" -        if sum(tmp2, []).count("#") == K: +# 塗らないなら1 +for row in product([0, 1], repeat=H): +    for col in product([0, 1], repeat=W): +        # 元が黒でタテヨコ塗らないマスを数える +        blacks = sum( +            [board[h][w] * row[h] * col[w] for h in range(H) for w in range(W)] +        ) +        if blacks == K: