import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



def contBlack(g, h, w):

    cnt = 0

    for i in range(h):

        for j in range(w):

            if g[i][j] == '#':

                cnt += 1

    return cnt



def turnrow(g, a, w):

    for j in range(w):

        g[a][j] = 'R'







def turnclumn(g, a, h):

    for i in range(h):

        g[i][a] = 'R'



from copy import deepcopy



def main():

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

    grid = []

    for _ in range(H):

        grid.append(list(eval(input())))



    cnt = 0

    for i in range(1<<H):           

        G = deepcopy(grid)

        for j in range(H):

            if (i>>j) & 1:

                turnrow(G, j, W)



        for k in range(1<<W):

            Gg = deepcopy(G)

            for l in range(W):

                if (k>>l) & 1:

                    turnclumn(Gg, l, H)

            

            # for i in range(H):

            #     print(Gg[i])

            # print()



            if contBlack(Gg, H, W) == K:

                cnt += 1



    print(cnt)

if __name__ == '__main__':

    main()

import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines



ans = 0

def main():

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

    grid = []

    for _ in range(H):

        grid.append(list(eval(input())))



    #再帰関数で二組の全bit探索を組む 

    #リストをコピーしない方法

    bitr = [0 for _ in range(H)]

    bitc = [0 for _ in range(W)]

    

    def dfsr(i): 

        if i == H:

            dfsc(0)

            return

        dfsr(i+1)

        bitr[i] = 1

        dfsr(i+1)        

        bitr[i] = 0

    

    def dfsc(i):

        global ans

        cnt = 0

        if i == W:

            #ここで処理をおこなう

            for j in range(H):

                #1が立っているならその行は全て赤とするので飛ばす

                if bitr[j] == 1: 

                    continue

                for k in range(W):

                    #1が立っているならその列は全て赤とするので飛ばす

                    if bitc[k] == 1:

                        continue

                    #飛ばされなかったマスのうち黒の数を数える

                    if grid[j][k] == '#':

                        cnt += 1

            if cnt == K:

                ans += 1

            return

        dfsc(i+1) 

        bitc[i] = 1

        dfsc(i+1)

        bitc[i] = 0

    

    dfsr(0)

    print(ans)

if __name__ == '__main__':

    main()

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines


def contBlack(g, h, w):
    cnt = 0
    for i in range(h):
        for j in range(w):
            if g[i][j] == "#":
                cnt += 1
    return cnt


def turnrow(g, a, w):
    for j in range(w):
        g[a][j] = "R"


def turnclumn(g, a, h):
    for i in range(h):
        g[i][a] = "R"


from copy import deepcopy


def main():
    H, W, K = list(map(int, readline().split()))
    grid = []
    for _ in range(H):
        grid.append(list(eval(input())))
    cnt = 0
    for i in range(1 << H):
        G = deepcopy(grid)
        for j in range(H):
            if (i >> j) & 1:
                turnrow(G, j, W)
        for k in range(1 << W):
            Gg = deepcopy(G)
            for l in range(W):
                if (k >> l) & 1:
                    turnclumn(Gg, l, H)
            # for i in range(H):
            #     print(Gg[i])
            # print()
            if contBlack(Gg, H, W) == K:
                cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
ans = 0


def main():
    H, W, K = list(map(int, readline().split()))
    grid = []
    for _ in range(H):
        grid.append(list(eval(input())))
    # 再帰関数で二組の全bit探索を組む
    # リストをコピーしない方法
    bitr = [0 for _ in range(H)]
    bitc = [0 for _ in range(W)]

    def dfsr(i):
        if i == H:
            dfsc(0)
            return
        dfsr(i + 1)
        bitr[i] = 1
        dfsr(i + 1)
        bitr[i] = 0

    def dfsc(i):
        global ans
        cnt = 0
        if i == W:
            # ここで処理をおこなう
            for j in range(H):
                # 1が立っているならその行は全て赤とするので飛ばす
                if bitr[j] == 1:
                    continue
                for k in range(W):
                    # 1が立っているならその列は全て赤とするので飛ばす
                    if bitc[k] == 1:
                        continue
                    # 飛ばされなかったマスのうち黒の数を数える
                    if grid[j][k] == "#":
                        cnt += 1
            if cnt == K:
                ans += 1
            return
        dfsc(i + 1)
        bitc[i] = 1
        dfsc(i + 1)
        bitc[i] = 0

    dfsr(0)
    print(ans)


if __name__ == "__main__":
    main()

- - -def contBlack(g, h, w): -    cnt = 0 -    for i in range(h): -        for j in range(w): -            if g[i][j] == "#": -                cnt += 1 -    return cnt - - -def turnrow(g, a, w): -    for j in range(w): -        g[a][j] = "R" - - -def turnclumn(g, a, h): -    for i in range(h): -        g[i][a] = "R" - - -from copy import deepcopy +ans = 0 -    cnt = 0 -    for i in range(1 << H): -        G = deepcopy(grid) -        for j in range(H): -            if (i >> j) & 1: -                turnrow(G, j, W) -        for k in range(1 << W): -            Gg = deepcopy(G) -            for l in range(W): -                if (k >> l) & 1: -                    turnclumn(Gg, l, H) -            # for i in range(H): -            #     print(Gg[i]) -            # print() -            if contBlack(Gg, H, W) == K: -                cnt += 1 -    print(cnt) +    # 再帰関数で二組の全bit探索を組む +    # リストをコピーしない方法 +    bitr = [0 for _ in range(H)] +    bitc = [0 for _ in range(W)] + +    def dfsr(i): +        if i == H: +            dfsc(0) +            return +        dfsr(i + 1) +        bitr[i] = 1 +        dfsr(i + 1) +        bitr[i] = 0 + +    def dfsc(i): +        global ans +        cnt = 0 +        if i == W: +            # ここで処理をおこなう +            for j in range(H): +                # 1が立っているならその行は全て赤とするので飛ばす +                if bitr[j] == 1: +                    continue +                for k in range(W): +                    # 1が立っているならその列は全て赤とするので飛ばす +                    if bitc[k] == 1: +                        continue +                    # 飛ばされなかったマスのうち黒の数を数える +                    if grid[j][k] == "#": +                        cnt += 1 +            if cnt == K: +                ans += 1 +            return +        dfsc(i + 1) +        bitc[i] = 1 +        dfsc(i + 1) +        bitc[i] = 0 + +    dfsr(0) +    print(ans)