#!/usr/bin/env python3



import itertools

import copy



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

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

for i in range(h):

    c[i] = list(eval(input()))



ccs = []



hnum = list(range(h))

wnum = list(range(w))



def countBlack(cc):

    ans = 0

    for i in range(h):

        ans += cc[i].count('#')

    return ans



ans = 0

# column

for i in range(w+1):

    for comb_column in list(itertools.combinations(wnum, i)):

        for p in range(h+1):

            for comb_row in list(itertools.combinations(hnum, p)):



                if len(comb_column)==w or len(comb_row)==h:

                    break



                cc = copy.deepcopy(c) 

                # print('comb_column =', comb_column)

                # print('len(comb_column) =', len(comb_column))

                # print('comb_row =', comb_row)

                # print('len(comb_row) =', len(comb_row))

                # column を塗る

                for j in range(len(comb_column)):

                    for j2 in range(h):

                        cc[j2][comb_column[j]] = 'R'



                # row を塗る

                for q in range(len(comb_row)):

                    for r in range(w):

                        cc[comb_row[q]][r] = 'R'



                # matrix

                # for s in range(h):

                #     print(cc[s])

                # print()



                ccs.append(cc)



for i in ccs:

    if k == countBlack(i):

        ans += 1



print(ans)
#!/usr/bin/env python3



import itertools

import copy



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

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



clist = list(itertools.product([0, 1], repeat=H+W))

#print(clist)



ans = 0 

for q in clist:

    black = 0 

    h = q[:H]

    w = q[H:]

    # print('h =', h)

    # print('w =', w)

    # print()



    for i in range(H):

        for j in range(W):

            if h[i] == w[j] == 1 and c[i][j] == '#':

                black += 1

    if black == k:

        ans += 1



print(ans)

#!/usr/bin/env python3
import itertools
import copy

h, w, k = list(map(int, input().split()))
c = [[] for _ in range(h)]
for i in range(h):
    c[i] = list(eval(input()))
ccs = []
hnum = list(range(h))
wnum = list(range(w))


def countBlack(cc):
    ans = 0
    for i in range(h):
        ans += cc[i].count("#")
    return ans


ans = 0
# column
for i in range(w + 1):
    for comb_column in list(itertools.combinations(wnum, i)):
        for p in range(h + 1):
            for comb_row in list(itertools.combinations(hnum, p)):
                if len(comb_column) == w or len(comb_row) == h:
                    break
                cc = copy.deepcopy(c)
                # print('comb_column =', comb_column)
                # print('len(comb_column) =', len(comb_column))
                # print('comb_row =', comb_row)
                # print('len(comb_row) =', len(comb_row))
                # column を塗る
                for j in range(len(comb_column)):
                    for j2 in range(h):
                        cc[j2][comb_column[j]] = "R"
                # row を塗る
                for q in range(len(comb_row)):
                    for r in range(w):
                        cc[comb_row[q]][r] = "R"
                # matrix
                # for s in range(h):
                #     print(cc[s])
                # print()
                ccs.append(cc)
for i in ccs:
    if k == countBlack(i):
        ans += 1
print(ans)

#!/usr/bin/env python3
import itertools
import copy

H, W, k = list(map(int, input().split()))
c = [list(eval(input())) for _ in range(H)]
clist = list(itertools.product([0, 1], repeat=H + W))
# print(clist)
ans = 0
for q in clist:
    black = 0
    h = q[:H]
    w = q[H:]
    # print('h =', h)
    # print('w =', w)
    # print()
    for i in range(H):
        for j in range(W):
            if h[i] == w[j] == 1 and c[i][j] == "#":
                black += 1
    if black == k:
        ans += 1
print(ans)

-h, w, k = list(map(int, input().split())) -c = [[] for _ in range(h)] -for i in range(h): -    c[i] = list(eval(input())) -ccs = [] -hnum = list(range(h)) -wnum = list(range(w)) - - -def countBlack(cc): -    ans = 0 -    for i in range(h): -        ans += cc[i].count("#") -    return ans - - +H, W, k = list(map(int, input().split())) +c = [list(eval(input())) for _ in range(H)] +clist = list(itertools.product([0, 1], repeat=H + W)) +# print(clist) -# column -for i in range(w + 1): -    for comb_column in list(itertools.combinations(wnum, i)): -        for p in range(h + 1): -            for comb_row in list(itertools.combinations(hnum, p)): -                if len(comb_column) == w or len(comb_row) == h: -                    break -                cc = copy.deepcopy(c) -                # print('comb_column =', comb_column) -                # print('len(comb_column) =', len(comb_column)) -                # print('comb_row =', comb_row) -                # print('len(comb_row) =', len(comb_row)) -                # column を塗る -                for j in range(len(comb_column)): -                    for j2 in range(h): -                        cc[j2][comb_column[j]] = "R" -                # row を塗る -                for q in range(len(comb_row)): -                    for r in range(w): -                        cc[comb_row[q]][r] = "R" -                # matrix -                # for s in range(h): -                #     print(cc[s]) -                # print() -                ccs.append(cc) -for i in ccs: -    if k == countBlack(i): +for q in clist: +    black = 0 +    h = q[:H] +    w = q[H:] +    # print('h =', h) +    # print('w =', w) +    # print() +    for i in range(H): +        for j in range(W): +            if h[i] == w[j] == 1 and c[i][j] == "#": +                black += 1 +    if black == k: